其他分享
首页 > 其他分享> > 下拉框联动

下拉框联动

作者:互联网

例如:学院和班级,学院改变后班级跟着改变

HTML:

<div class="lr-layout-tool-item" style="padding-top:20px">学院</div>
<div class="lr-layout-tool-item">
<div id="dwbh" style="width:200px"></div>
</div>
<div class="lr-layout-tool-item" style="padding-top:20px">班级</div>
<div class="lr-layout-tool-item">
<div id="banji" style="width:200px"></div>
</div>

 

js:

$('#dwbh').lrselect({
url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable',
param: { code: "tjdw", strWhere: "", queryJson: "{}" },
value: 'xueyuan',
text: 'xueyuan',
allowSearch: true,
maxHeight: 200,
select: function (item) {
if (item) {
if (!!item) {
//学院、班级联动
$('#banji').lrselectRefresh({
url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable',
param: { code: "tjbm", strWhere: "xueyuan = '" + item.xueyuan + "'", queryJson: "{}" },
});
}
}
}
});
//体检部门
$('#banji').lrselect({
url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable',
param: { code: "tjbm", strWhere: "", queryJson: "{}" },
value: 'banji',
text: 'banji',
allowSearch: true,
maxHeight: 200,
select: function (item) {
}
});

 

取值:

var banji= $("#banji").lrselectGet();

 

标签:班级,code,banji,item,xueyuan,联动,SystemModule,下拉框
来源: https://www.cnblogs.com/mengweidu/p/16541584.html