Domanda

I'm using Rniemeyer's kncokout-kendo.js http://rniemeyer.github.io/knockout-kendo/web/Grid.html

I've 'People' and I need to get selected Person.

<div id="grid" style="width:450px" data-bind="kendoGrid: {height:400,columns:['Id','Name'],navigatable:true,selectable:true,rowTemplate: 'rowTmpl', useKOTemplates: true,data: People, select: SelectedPerson,value:SelectedPerson }" ></div>

neither 'select' nor 'value' works.

People is observableArray

The example does not work both SelectedPerson is observable, SelectedPerson is observableArray.

È stato utile?

Soluzione

I'm not familiar with Kendo, but judging from this existing fiddle I think you need to use the change option as part of your grid configuration:

kendoGrid: { change: function (event) {
                         self.selectedData(this.dataItem(this.select()[0]));
                     }
}

See this fiddle which contains the code from the question (with a few options commented out because no View code was posted in the question).

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top