Kendo UI dropdownlist 后台绑定默认值
程序员文章站
2022-06-11 22:41:39
...
<div style="display:block;float:left;width:100%;min-width:175px;height:80%;margin-top:7px">
<input id="Exp_Position" inputRequired="required" onblur="inputRequiredChange(this)"
data-role="dropdownlist"
data-text-field="Exp_PositionName"
data-value-field="Exp_PositionID"
data-filter="contains"
data-bind="value:expenseApply.Exp_PositionID, source:PositionResource,events:{change:PositionChange}">
<span class='k-widget k-tooltip k-tooltip-validation field-validation-error k-required' style="display:none;position: absolute;top: 90%;left: 0;">职务不能为空</span>
</div>
//职务数据源
PositionResource: new kendo.data.DataSource({
transport: {
read: {
url: "/BaseData/PositionList"
}
},
schema: {
model: {
id: "Exp_PositionID"
}
},
requestEnd: function (res) {
if (res && res.response && res.response.length > 0) {
var defaultPosition = _.find(res.response, function (t) {
return t.IsDefault;
});
console.log(expenseApplyCreateViewModel.expenseApply);
if (defaultPosition) {
expenseApplyCreateViewModel.expenseApply.set("Exp_PositionID", defaultPosition.Exp_PositionID);
expenseApplyCreateViewModel.expenseApply.set("Exp_PositionName", defaultPosition.Exp_PositionName);
}
}
}
}),
/// <summary>
/// 职务数据源
/// </summary>
/// <returns></returns>
[Data]
public ActionResult PositionList()
{
ExpInnerOrderService proc = new ExpInnerOrderService();
List<CndModel> pars = new List<CndModel>();
//pars.Add(new CndModel("(USER_CODE = '" + UserContext.UserID + "')"));
var result = proc.GetExpOraclePositionList( pars, "order by JOB_CID ");
if (!result.IsNullOrCountZero())
{
var defaultPosition= result.FirstOrDefault();
defaultPosition.IsDefault = true;
}
result.SetRowindx();
return Json(result, JsonRequestBehavior.AllowGet);
}
上一篇: pytorch入门学习(三)-----线性回归模型
下一篇: Pytorch入门案例---线性回归
推荐阅读
-
Jquery加载时从后台读取数据绑定到dropdownList实例
-
Kendo UI dropdownlist 获取选中数据
-
Kendo UI dropdownlist 后台绑定默认值
-
asp:DropDownList动态绑定数据,设置默认值
-
应用程序的图表如何绑定数据?Kendo UI有妙招 AngularKendo UItelerik图表
-
应用程序的图表如何绑定数据?Kendo UI有妙招 AngularKendo UItelerik图表
-
Jquery加载时从后台读取数据绑定到dropdownList实例
-
Jquery加载时从后台读取数据绑定到dropdownList实例_jquery
-
Jquery加载时从后台读取数据绑定到dropdownList实例_jquery
-
element-UI,根据后台数据、动态生成el-checkbox-group,点击提交获取绑定checked项以及实现显示默认checked项