【HTML】
<div class="page-title-box">
<div id="divPageTitle" data-role="title"></div>
<div id="divBranch">
<label for="branch">分店:</label>
<div id="branch"></div>
</div>
</div>
branchList: null,
getBranchList: function (finished) {
var that = this;
myBOCaller.getBranchList(function(result){
//用返回值并更新List
that.branchList = utils.getPropValue(result);
//回调页面函数
finished(that.branchList);
});
},
outletList: null,
getOutletList: function (finished) {
var that = this;
myBOCaller.getOutletList(this.branchID,
function (result) {
//用返回值并更新List
that.outletList = utils.getPropValue(result);
//回调页面函数
finished(that.outletList);
});
},
onBeforeOpen: function (e) {
if (e.where)
e.where += " and ";
e.where += "(aBranchID = '" + this.branchID + "')";
},
onAfterAdd: function (e) {
if (e.tableName.toLowerCase() == "PubOutlet".toLowerCase()) {
e.currentItem.set("BranchID", this.branchID);
}
},
【Browser】
this.isAutoOpen = false;
onAfterInit: function (e) {
//装载分店资料
this.dm.getBranchList(function (result) {
$("#branch").kendoDropDownList({
index: -1,
dataTextField: "BranchName",
dataValueField: "ID",
valuePrimitive: true,
dataSource: result,
change: function () {
var branch = $("#branch").data("kendoDropDownList");
if (branch) {
var id = branch.value();
page.dm.branchID = id;
page.openData("", "");
};
},
});
//默认选择第一个
if (page.dm.branchList.length) {
var branch = $("#branch").data("kendoDropDownList");
branch.select(0);
branch.trigger("change");
}
});
},
onBeforeShowEditor: function (e) {
var branchID = null;
var branch = $("#branch").data("kendoDropDownList");
if (branch)
branchID = branch.value();
if (!branchID) {
smartAlert("请选择分店");
e.ignore = true;
};
e.params.push("branchID=" + branchID);
},
【Editor】
this.dm.branchID = utils.getRequestParams()["branchID"] || null;
onAfterInit: function () {
//装载营业部门
this.dm.getOutletList(function (result) {
$("#inpOutlet").kendoComboBox({
index: -1,
dataTextField: "OutletName",
dataValueField: "ID",
valuePrimitive: true,
dataSource: result,
change: function (e) {
var value = this.value();
if (value && this.selectedIndex == -1) {
smartAlert("输入了无效的营业部门。");
this.value("");
};
},
});
});
},
<div class="page-title-box">
<div id="divPageTitle" data-role="title"></div>
<div id="divBranch">
<label for="branch">分店:</label>
<div id="branch"></div>
</div>
</div>
【DM】
mediaTypeList: [
{ name: "ID卡", value: 0 },
{ name: "IC卡", value: 1 },
{ name: "可视卡", value: 2 },
],
branchList: null,
getBranchList: function (finished) {
var that = this;
myBOCaller.getBranchList(function(result){
//用返回值并更新List
that.branchList = utils.getPropValue(result);
//回调页面函数
finished(that.branchList);
});
},
outletList: null,
getOutletList: function (finished) {
var that = this;
myBOCaller.getOutletList(this.branchID,
function (result) {
//用返回值并更新List
that.outletList = utils.getPropValue(result);
//回调页面函数
finished(that.outletList);
});
},
onBeforeOpen: function (e) {
if (e.where)
e.where += " and ";
e.where += "(aBranchID = '" + this.branchID + "')";
},
onAfterAdd: function (e) {
if (e.tableName.toLowerCase() == "PubOutlet".toLowerCase()) {
e.currentItem.set("BranchID", this.branchID);
}
},
【Browser】
this.isAutoOpen = false;
onAfterInit: function (e) {
//装载分店资料
this.dm.getBranchList(function (result) {
$("#branch").kendoDropDownList({
index: -1,
dataTextField: "BranchName",
dataValueField: "ID",
valuePrimitive: true,
dataSource: result,
change: function () {
var branch = $("#branch").data("kendoDropDownList");
if (branch) {
var id = branch.value();
page.dm.branchID = id;
page.openData("", "");
};
},
});
//默认选择第一个
if (page.dm.branchList.length) {
var branch = $("#branch").data("kendoDropDownList");
branch.select(0);
branch.trigger("change");
}
});
},
onBeforeShowEditor: function (e) {
var branchID = null;
var branch = $("#branch").data("kendoDropDownList");
if (branch)
branchID = branch.value();
if (!branchID) {
smartAlert("请选择分店");
e.ignore = true;
};
e.params.push("branchID=" + branchID);
},
【Editor】
this.dm.branchID = utils.getRequestParams()["branchID"] || null;
onAfterInit: function () {
//装载营业部门
this.dm.getOutletList(function (result) {
$("#inpOutlet").kendoComboBox({
index: -1,
dataTextField: "OutletName",
dataValueField: "ID",
valuePrimitive: true,
dataSource: result,
change: function (e) {
var value = this.value();
if (value && this.selectedIndex == -1) {
smartAlert("输入了无效的营业部门。");
this.value("");
};
},
});
});
},