Hi,
I have a question regarding client side binding. I think I am missing something here but can't find any information on how to properly do this from the documentation. Anyhow, I am using json object to bind to the grid as my datasource. I have no problem binding this to the grid. I tried it with a default grid without any settings and it works like a charm. The problem i get is when I tried to do paging. I put PageSize="2" and AllowPaging="True" as seen below and it simply doesn't work. In my example below I have 6 items, it always shows 6 items in the grid even with the page size set to 2. The paging icons below the grid seems to show the right numbers though based on the row count I declared. (mtv.set_virtualItemCount(msg.length);)
To add to that, when I try to click the next page (or any paging button), the grid just disappears.
A simple example like this that works would be very helpful.
//javscript
function bindGrid(){
var msg = [{ "ID": 1, "Text": "Text1" }, { "ID": 2, "Text": "Text2"},
{ "ID": 3, "Text": "Text3"}, { "ID": 4, "Text": "Text4"},
{ "ID": 5, "Text": "Text3"}, { "ID": 6, "Text": "Text6"} ]
var grid = $find("<%= RadGrid1.ClientID %>")
var mtv = grid.get_masterTableView();
mtv.set_dataSource(msg);
mtv.dataBind();
mtv.set_virtualItemCount(msg.length);
}
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
>
<
mastertableview
PageSize
=
"2"
AllowPaging
=
"true"
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"ID"
HeaderText
=
"ID"
/>
<
telerik:GridBoundColumn
DataField
=
"Text"
HeaderText
=
"DocName"
/>
</
Columns
>
</
mastertableview
><
br
>
<
clientsettings
>
<
ClientEvents
OnCommand
=
function
(){}
/>
</
clientsettings
>
</
telerik:RadGrid
>