Reputation: 342
I'm trying my first kogrid I'm trying to use it to display a simple data grid. The code runs, but doenst show anything. jsfiddle is at http://jsfiddle.net/z5Pdy/6/
HTML IS
<div style="height: 300px; width:600px;"
data-bind="koGrid: { data: brokerCommissions.list,
isMultiSelect: false,
selectedItem: selectedBroker,
columnDefs: [
{ field: 'broker', displayName: 'First Name' }
]}"></div>
javascript is
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();
can anyone tell me why.
Upvotes: 1
Views: 1406
Reputation: 126072
Your main problem is that you're not including the koGrid JS file correctly (if you check out your browser's dev tools you'll see a 404 being returned when the script is requested).
Your other problem is that you're using brokerCommissions.list
, which does not exist. Try just brokerCommissions
instead:
<div style="height: 300px; width:600px;"
data-bind="koGrid: { data: brokerCommissions,
isMultiSelect: false,
selectedItem: selectedBroker,
columnDefs: [
{ field: 'broker', displayName: 'First Name' }
]}"></div>
Updated fiddle: http://jsfiddle.net/z5Pdy/8/
Upvotes: 1