This is a migrated thread and some comments may be shown as answers.

Selected Item - not recognizing

2 Answers 76 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Don
Top achievements
Rank 2
Don asked on 14 Jul 2012, 01:29 AM
I have a grid with a local data array.
how can I do a row select on it?
Thanks-

              
                         $("#dataGrid").kendoGrid({
                             dataSource: {
                                data: customerData, // local array
                                schema: { model: {id: "CustomerPK"} },
                                group: [ { field: "CustomerType", dir: "asc" }]
                             },                             
                             groupable: true,
                             selectable: true,
                            change: function() {
                                var custID = this.select().data("id");
                                alert("Selected " + custID); // 'undefined'
                                }
                         });  

2 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 18 Jul 2012, 10:04 AM
Hello Don,

May be you are looking for selectable docs.

Regards,
Nikolay Rusev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Don
Top achievements
Rank 2
answered on 26 Jul 2012, 11:12 PM
no - but I made a hack.
I am able to get the index of the row, then look back into my data object to pull out the actual ID of my entity.
ackward but it is working.

$("#dataGrid").kendoGrid({
            // ...
        change: function(){
            //this.select().data("id");
            var myIndex= this.select().index();            
            alert(customerData[myIndex].id);
        }
});

Tags
Grid
Asked by
Don
Top achievements
Rank 2
Answers by
Nikolay Rusev
Telerik team
Don
Top achievements
Rank 2
Share this question
or