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

How can I select rows in a KendoUI Grid when the datakeys come from several fields?

1 Answer 54 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 2
Patrick asked on 05 Jul 2012, 09:38 PM
I have a database table where the primary key is a combination of several fields:

Field1, Field2, Field3

If it was just one field (Field1) I could use 

.DataSource(dataSource => dataSource
,Server()
.Model(model => model.Id(p => p.Field1))
)

but how do I set the datakeys/model id when there are several fields?

(If I set the grid to be .Selectable and if I don't set the model id, I get an error message saying that the DataKeys aren't set.)

Thanks.

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 09 Jul 2012, 07:13 AM
Hi Patrick,

You need to specify some property of the model as Id - if it is not unique it will not affect the Selectable functionality working properly although there might be issues when editing.


Regards,
Petur Subev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Patrick
Top achievements
Rank 2
Answers by
Petur Subev
Telerik team
Share this question
or