Hello, I've an issue with client-side databinding of a RadGrid. In fact, when I do a .set_dataSource(<dataSource>) and a .dataBind(), data is successfully loaded in the RadGrid but the length of the property _dataItems doesn't change.
Here is the code of the RadGrid:
Here is the code executed in order to load data in the RadGrid:
Example to explain you more clearly my issue:
At the first client-side loading, 126 rows are binded in the RadGrid and selected. So the method .get_dataItems() and the method .get_selectedItems() returm 126 items, it's good. But at the second client-side loading, 4 rows are binded in the RadGrid and selected. The grid display 4 rows so it seems to be good again.. but in fact, when I try to do .get_dataItems() or .get_selectedItems() it returns 126 items again! The 4 first items in _dataItems property are the 4 correct items but there're 122 other items (old items).
I tried to manually delete all items in property _dataItems of the grid but it doesn't work.
I need to know which items are selected so it's a real problem.
Thank's for your help.
Here is the code of the RadGrid:
<
Telerik:RadGrid
ID
=
"RGWebsites"
runat
=
"server"
OnNeedDataSource
=
"RGWebsites_NeedDataSource"
AllowMultiRowSelection
=
"true"
ClientSettings-DataBinding-EnableCaching
=
"false"
>
<
MasterTableView
AutoGenerateColumns
=
"False"
DataKeyNames
=
"WebsiteID"
ClientDataKeyNames
=
"WebsiteID"
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"WebsiteID"
HeaderText
=
"Website ID"
HeaderStyle-Width
=
"20%"
ItemStyle-Width
=
"20%"
/>
<
telerik:GridBoundColumn
DataField
=
"ContractType"
HeaderText
=
"Contract type"
HeaderStyle-Width
=
"20%"
ItemStyle-Width
=
"20%"
/>
<
telerik:GridBoundColumn
DataField
=
"WebsiteName"
HeaderText
=
"Website name"
HeaderStyle-Width
=
"20%"
ItemStyle-Width
=
"20%"
/>
<
telerik:GridBoundColumn
DataField
=
"StartDate"
HeaderText
=
"Start date"
HeaderStyle-Width
=
"20%"
ItemStyle-Width
=
"20%"
DataType
=
"System.DateTime"
DataFormatString
=
"{0:MM/dd/yyyy}"
/>
<
telerik:GridBoundColumn
DataField
=
"EndDate"
HeaderText
=
"End date"
HeaderStyle-Width
=
"20%"
ItemStyle-Width
=
"20%"
DataType
=
"System.DateTime"
DataFormatString
=
"{0:MM/dd/yyyy}"
/>
</
Columns
>
</
MasterTableView
>
<
ClientSettings
>
<
Selecting
AllowRowSelect
=
"true"
/>
</
ClientSettings
>
</
Telerik:RadGrid
>
Here is the code executed in order to load data in the RadGrid:
function
onSuccessGetWebsites(result) {
if
(result && result.Data !== undefined) {
var
tableView = RGWebsites.get_masterTableView();
tableView.set_dataSource(result.Data);
tableView.dataBind();
// By defaut all rows are selected
tableView.selectAllItems();
resizeHeight();
}
else
{
if
(result.Message) {
showError(result.Message, 0);
}
else
{
showError(
'onSuccessGetWebsites() result param is empty !'
, -1);
}
}
$(
'#'
+ RGWebsites.get_element().id).unblock();
};
Example to explain you more clearly my issue:
At the first client-side loading, 126 rows are binded in the RadGrid and selected. So the method .get_dataItems() and the method .get_selectedItems() returm 126 items, it's good. But at the second client-side loading, 4 rows are binded in the RadGrid and selected. The grid display 4 rows so it seems to be good again.. but in fact, when I try to do .get_dataItems() or .get_selectedItems() it returns 126 items again! The 4 first items in _dataItems property are the 4 correct items but there're 122 other items (old items).
I tried to manually delete all items in property _dataItems of the grid but it doesn't work.
I need to know which items are selected so it's a real problem.
Thank's for your help.