我發佈了一個問題,其他人得到了答案,my answered question,我很感謝,我修改了我的代碼以匹配其他成員代碼,他在Telerik的道場Heres a dojo 一切都建立是布萊恩好,直到我達到未捕獲TypeError:無法讀取未定義變量的屬性'set'masterRow在KendoUI中未定義Grid detailInit
var masterRow = masterGrid.dataSource.get(groupID);
多數民衆贊成在我得到它的不確定,我不知道爲什麼......我的完整的代碼
function onSelectedRowClick(e) {
var catalogGrid = $("#CatalogGrid").data("kendoGrid");
var selectedID = catalogGrid.dataItem(catalogGrid.select());
var theID = selectedID.globalGroupID;
myID = theID;
groupID = myID;
}
var myID;
// #region Catalog Grid
var groupID;
function TheCatalogGrid(catalogData) {
$("#CatalogGrid").kendoGrid({
dataSource: {
data: catalogData
},
schema: {
model: {
id: "globalGroupID",
}
},
columns: [
{ field: "globalGroupLevel", title: "globalGroupLevel", hidden: true },
{ field: "globalGroupName", title: "Group Name", width:350 },
{ field: "isRequired", title: "*", width:20 },
{ field: "optionName", title: "Option Name" },
{ title: "Description" },
{ title: "Price" }
],
change: function (e) {
onSelectedRowClick();
},
scrollable: true,
pageable: false,
selectable: "row",
height: 500,
dataBound: function (e) {
var data = this.dataSource.data();
$.each(data, function (i, row) {
if (row.get("globalGroupLevel") == 0) {
var element = $('tr[data-uid="' + row.uid + '"] ');
element.addClass("colored-row");
}
});
},
detailInit: detailInit,
detailExpand: function(e){
groupID = this.dataItem(e.masterRow).get("globalGroupID");
},
});
}
function detailInit(e) {
$("<div/>").appendTo(e.detailCell).kendoGrid({
dataSource: {
transport: {
read: URLParams.GetTheGlobalGroupOptions + "?id=" + groupID
},
},
scrollable: false,
selectable: "row",
filter: { field: "GlobalGroupID", operator: "eq", value: e.data.globalGroupID },
change: function (e) {
// get detail row
var detailRow = this.dataItem(this.select());
var optionName = detailRow.get("OptionName") // Change this stuff to populate into the correct columns
// get master row
var masterGrid = $("#CatalogGrid").getKendoGrid();
var masterRow = masterGrid.dataSource.get(groupID);
// set 'Option Name' value to master row 'optionName' field
masterRow.set("optionName", optionName);
},
columns: [
{ field: "OptionName", title: "Option Name" },
{ field: "OptionDescription", title: "Description" },
{ field: "OptionPriceComment", title: "Price" }
]
});
}
關於爲什麼它未來定義的任何想法?
我只是測試這是我的環境,它完美的工作,非常感謝你! 你很瞭解你的劍道,有沒有關於劍道的書,就像Telerik UI for ASP.NET AJAX一樣?或者深入瞭解任何KendoUI書籍/教程? – Chris
我更像是一個自學的人......我在過去的2年中一直在使用網格,這就是我學習它的方式。當你有特定的問題時,SO和Telerik的論壇可能是最好的資源。 –
我幾個月來一直在使用Kendo,但我很瞭解ASP.NET AJAX的UI。但是這兩個框架完全不同。感謝您的幫助和指導,我很欣賞它,並從中學到了一些東西。 – Chris