AM 尝试将 Kendo Grid 与 Lightswitch 一起使用。
我可以使用本地数据进行数据绑定。
当我绑定到灯开关数据时,什么都没有显示。
代码看起来像这样
myapp.BrowsePeople.People_render = function (element, contentItem) {
var localPeople = [{ FirstName: "John", LastName: "Smith", email: "john.smith@kendoui.com" },
{ FirstName: "Jane", LastName: "Smith", email: "jane.smith@kendoui.com" },
{ FirstName: "Josh", LastName: "Davis", email: "josh.davis@kendoui.com" },
{ FirstName: "Cindy", LastName: "Jones", email: "cindy.jones@kendoui.com" }];
var grdPeople = $('<div id="KendoPeopleDiv"></div>').appendTo(element);
var lsPeople = contentItem.screen.People;
lsPeople.addChangeListener("state", function () {
if (lsPeople.state === msls.VisualCollection.State.idle)
{
grdPeople.kendoGrid({
columns: [{ title: "First Name", field: "FirstName" }, { title: "Last Name", field: "LastName" }],
dataSource: lsPeople.data
//dataSource: localPeople
});
}
});
};
如所示,如果我使用“dataSource:localPeople”,它会显示静态列表。如果我使用“dataSource:lsPeople.data”标题sho,但没有记录。
我在调试器中检查了“lsPeople.data”,它有 2 条记录,名字和姓氏。
提前致谢