我在另一个 Telerik Grid 中有一个嵌套的 Telerik Grid,我想强制网格在每次扩展父网格时刷新自身。嵌套网格中的数据可以快速更改,因此我需要嵌套网格在每次展开事件时刷新自身。
我的 Telerik 网格:
<div>
@(Html.Telerik().Grid<RentableUnit>()
.Name("RentableUnits")
.Columns(columns =>
{
columns.Bound(e => e.UnitID).Hidden();
columns.Bound(e => e.Name).Width(800);
columns.Bound(e => e.IsExpanded).Hidden();
})
.ClientEvents(events => events.OnRowDataBound("employees_onRowDataBound")
.OnDetailViewExpand("unit_onDetailViewExpand")
.OnDetailViewCollapse("unit_onDetailViewCollapse")
.OnDetailViewExpand("toggleDetail")
)
.DetailView(details => details.ClientTemplate(
//stuff in template
)
.DataBinding(dataBinding => dataBinding.Ajax().Select("RentableUnits", "Home"))
.Sortable()
)
</div>
我的Javascript:
function unit_onDetailViewExpand(e) {
var mstRow = e.masterRow;
var unitNumber = mstRow.cells[1].innerHTML;
var grid = $(this).data('tGrid');
grid.$rows().not(e.masterRow).each(function(index, row) {
grid.collapseRow(row);
});
//I´ve been trying to force databinding on the grid row
grid.expandRow(e.row);
//I´ve been trying this among others but I´m missing something
}
谁能指出我如何强制网格重新绑定的正确方向?很感谢任何形式的帮助 :)