首先两个下拉框分别对应两个表数据,两表通过堆号字段关联
另外编辑和添加的dialog都用的是一个,所以字段名要和datagrid的名称对应。点击编辑某一行时,弹出dialog,数据依次赋值并显示,点击新增时,弹出dialog,数据清空。
//堆号和物料关联 function Heapnumber_MaterialID() {
var $heap = $("#Heapnumber"); //堆号下拉列表 var $mater = $("#MaterialID"); //物料下拉列表 var cc = ''; $heap.combobox({
url: '../ashx/EasyUiAshx/SPBalloutplanHandler.ashx?action=select&&option=HeapnumberIDcombox', valueField: 'Heapnumber', textField: 'Heapnumber', panelHeight: 'auto', editable: false, onChange: function (newValue, oldValue) {
if (newValue != "") {
cc = newValue; $mater.combobox({
disabled: false, url: '../ashx/EasyUiAshx/SPBalloutplanHandler.ashx?action=select_Material&&option2=' + newValue, method: 'GET', valueField: 'MaterialID', textField: 'MaterialDes', panelHeight: 'auto', editable: false, onLoadSuccess: function () {
var data = $mater.combobox("getData"); $mater.combobox("setValue", data[0].MaterialID); //注意赋值的方法,很重要。 } }); } }, onLoadSuccess: function () {
var AA = $("#Heapnumber").combobox('getValue'); //编辑的时候有值,新增的时候无值。 if (AA != "") {
$mater.combobox({
disabled: false, url: '../ashx/EasyUiAshx/SPBalloutplanHandler.ashx?action=select_Material&&option2=' + AA, method: 'GET', valueField: 'MaterialID', textField: 'MaterialDes', panelHeight: 'auto', editable: false, onLoadSuccess: function () {
var data = $mater.combobox("getData"); $mater.combobox("setValue", data[0].MaterialID); } }); } } }); }
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/213055.html原文链接:https://javaforall.net
