如何使用javascript绑定剑道网格单元
How to bind the kendo grid cell using javascript
我在应用程序中使用了剑道网格。在网格中,一行包含一个下拉列表。当我在下拉列表中选择值时,行中的其他单元格将更新。但我正在尝试使用javascript更新另一个单元格。我找不到解决这个问题的办法。
有人能帮我吗?
我的剑道网格在剃刀:
@(Html.Kendo().Grid<models.employee>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(c => c.name).ClientTemplate(
"<input type='hidden' name='items[#= index(data)#].name' value='#= getLine(data)#' /> <p>#= getLine(data)#</p>"
);
columns.Bound(c => c.Emp_num).EditorTemplateName("EmpEditor").ClientTemplate(
"#= Emp_num #" +
"<input type='hidden' class='Emp-select' name='items[#= index(data)#].Emp_num' id='items[#= index(data)#].Emp_num' value='#= Emp_num #' />"
);
columns.Bound(c => c.description).EditorTemplateName("DescripEditor").ClientTemplate(
"#= description #" +
"<input type='hidden' name='items[#= index(data)#].description' data-fill='items[#= index(data)#].description' value='#= description #' />"
);
columns.Bound(c => c.address).EditorTemplateName("addressEditor").ClientTemplate(
"#= address #" +
"<input type='hidden' name='items[#= index(data)#].address' value='#= address #' data-fill='items[#= index(data)#].address' value='' />"
);
})
在EmpEditor.cshtml:中
@(Html.Kendo().DropDownList()
.Name("Emp_num")
.OptionLabel("Select Employee Number...")
.DataValueField("Emp_num")
.DataTextField("Emp_num")
.BindTo((System.Collections.IEnumerable)ViewData["Employee"])
.Events(e => e.Select("changes"))
)
javascript:
function changes(e)
{
var Emp_num = this.dataItem(e.item).Emp_num; // which gives the employee num
getEmp(Emp_num, function (emp) { //this function retrieve the details of employee for the particular employee number
var Employee = emp;
//here I need the code for update the values of Employee.description to description cell and Employee.address to address cell
});
}
在没有看到您的代码的情况下,我想您有某种模板将您的dropdownlist定义为剑道网格列定义的一部分,对吧?您需要编写一个JavaScript函数来更新单元格,并将其添加到此下拉列表的onChange中。剑道医生可能会报道这一点。
相关文章:
- ExtJS网格单元格编辑器,防止焦点松动问题
- ExtJ将工具提示添加到网格单元格文本中
- 编辑后更改切片网格单元格数据
- 剑道网格单元格 :如何自动修剪文本以避免换行
- jQuery 单击事件在包含在光滑网格单元格中时不会为锚点触发
- 咏叹调网格单元格标签在 SVG 矩形内始终为空白
- 在网格单元中绘制组件-extjs 4
- Kendo UI网格单元格中的工具栏菜单,菜单是从哪个行单击的
- 使用HTML按钮更改ng网格单元格值
- Kendo UI网格-单元格上的标题属性
- 显示网格单元格中的窗口?EXTjs
- 如何使用javascript绑定剑道网格单元
- 清除activateextjs4上的可编辑网格单元格
- kendou网格单元格修剪数据值
- 剑道-在选择网格单元格时更新另一个网格(mvvm)
- 剑道网格如何以编程方式聚焦网格单元格和块选择文本
- 移除网格单元格之间的空间
- 在js/html/css中创建一个可点击的网格单元格
- 在ExtJS4中悬停时获取网格单元值
- ExtJs 6.0:使用组合框编辑网格单元格-不同步id值