<script type="text/javascript">
function columnTemplate(cell, item) {
var drivers = @Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(Model.dirvers));
$('<select/>')
.appendTo(cell)
.shieldDropDown({
dataSource: {
data: drivers
}
,
editing:
{
enabled: true
}
,
textTemplate: "{FullName}"
,valueTemplate: "{DriverID}"
,events: {
select: function(e) {
alert("#list select:" +
e.item.FullName + ":" + e.item.DriverID+ " : "+
e.index);
// here I want to calculated which driver is selected then set the other cell value
}
}
});
}
</script>
请帮帮我
答案 0 :(得分:1)
您可以为其他单元格设置columnTemplate,如下所示:
columnTemplate: function(cell, item, index) {
$('<span id="uniqueid_' + index + '"/>')
.appendTo(cell);
}
然后在DropDown的select处理程序中,您可以通过从columTemplate()处理程序的第3个参数获取行索引来引用和更新该元素...