我正在尝试我的第一个 kogrid,我正在尝试用它来显示一个简单的数据网格。代码运行,但没有显示任何内容。jsfiddle 在http://jsfiddle.net/z5Pdy/6/
HTML 是
<div style="height: 300px; width:600px;"
data-bind="koGrid: { data: brokerCommissions.list,
isMultiSelect: false,
selectedItem: selectedBroker,
columnDefs: [
{ field: 'broker', displayName: 'First Name' }
]}"></div>
javascript是
function AppViewModel() {
var self = this;
self.brokerCommissions = ko.observableArray([
{
"broker": "y",
"c": 0},
{
"broker": "x",
"c": 0}
]);
self.selectedBroker = ko.observable();
}
function initializeKO() {
VM = new AppViewModel();
ko.applyBindings(VM);
}
initializeKO();
谁能告诉我为什么。