最近开始学编程。使用了MVC,EF。界面上使用easy ui。
easy ui遇到一个需求,就是第一个下拉框选择数据后,第二个下拉框的数据要相应的改变。经过网上查资料和泡论坛,终于实现了。
现整理一个,留以后查用,也希望能给其他人提供帮助。
这是实现的界面:
首先在view里定义一个table。注意这个只定义一个table就可以,具体的设置在JS里处理。
<table id="bomdg" style="height: 569px">
</table>
接着,建立一个js文件,在文件里编写代码:
$(function () {
//初始化界面上的datagrid
$("#bomdg").datagrid({
toolbar: '#tb',
singleSelect: true,
onClickRow: onClickRow,
columns: [[
{
title: '物料',
field: 'pdm_bomdetail_tb_id_part',
width: 180,
formatter: function (value, row) {
return row.name;
},
editor: {
type: 'combobox', //设置第一个下拉框
options: {
valueField: 'id',
t