這是我當前的網格和detailExpand/Databind。您會看到我試圖獲取uid,然後在數據綁定觸發後展開該行。未定義expandedRowUid控制檯日誌。有人可以幫助我正確地獲得uid或提供替代解決方案,以便一旦觸發了數據綁定,細節網格不會崩潰或在數據綁定後再次展開。在數據綁定後保留kendo細節網格
function teacherHierarchyGrid() {
$("#teacherGrid").kendoGrid({
detailInit: detailInit,
selectable: true,
dataBound: function() {
console.log("Bind occured")
this.expandRow($('tr[data-uid=' + expandedRowUid + ']'));
},
detailExpand: function (e)
expandedRowUid = e.masterRow.data('uid');
console.log(expandedRowUid)
},
})
}
**編輯**新代碼仍然沒有工作
var expandedRow;
function teacherHierarchyGrid() {
$("#teacherGrid").kendoGrid({
detailInit: detailInit,
selectable: true,
autoBind: false,
dataBound: function(e){
if (expandedRow) {
console.log(expandedRow);
e.sender.expandRow($('tr[data-uid=' + expandedRow + ']'));
}
},
detailExpand: function (e) {
expandedRow = e.sender.dataItem(e.masterRow).uid;
},
})
}
是否希望自動展開所有詳細信息行?如果是這樣,[檢查此鏈接](http://www.telerik.com/forums/how-to-auto-expand-all-detail-rows-in-a-kendo-grid-#Y7UlVX19GE2_ZUsfXFr8kg) – Sandman