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

set_virtualItemCount(count) doesn't work?

3 Answers 117 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Elton
Top achievements
Rank 1
Elton asked on 10 Oct 2008, 12:25 AM
Hello,

I am trying to do paging with client side data binding.

masterTbView.set_dataSource(result);

masterTbView.dataBind();

masterTbView.set_virtualItemCount(1000);

....

but the set_virtualItemCount() doesn't have any effect at all. On the footer it always give me Page 1 at all.
I tried the example on your site it works fine.

Just wonder if you can give us some hints on this issue, like what attribute we should turn on, or what event handler we should implement?

Thank you very much,
Elton

 

3 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 14 Oct 2008, 06:39 AM
Hello Elton,

You can find working example here. And it seems to be working.
Can you show us a little bit of your code?

Regards,
Nikolay
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Brett Howard
Top achievements
Rank 1
answered on 21 Nov 2008, 05:33 PM

We are having a similar issue with the .set_virtualItemCount() which causes an exception everytime we try to set the property.

tableView.set_virtualItemCount(e.TotalRowCount); //Here is where the exception is generated. In the debugger we get the following exception : Microsoft JScript runtime error: Sys.ArgumentUndefinedException: Value cannot be undefined.
Parameter name: id

Does anyone know why this is happening.
Below is the sample markup.

Additional Info :
The tableView.set_virtualItemCount() method throws an exception if we provide any int value.
The data is able to bind as long as we do not set this property.

VS2008
.NET 3.5


 

 

<telerik:RadGrid ID="RadGrid1" AutoGenerateColumns="false" runat="server">

 

 

 

 

 

<MasterTableView>

 

 

 

 

 

<Columns>

 

 

 

 

 

<telerik:GridBoundColumn DataField="NewId" SortExpression="NewId" HeaderText="Id"></telerik:GridBoundColumn>

 

 

 

 

 

<telerik:GridBoundColumn DataField="FirstName" SortExpression="FirstName" HeaderText="First Name"></telerik:GridBoundColumn>

 

 

 

 

 

<telerik:GridBoundColumn DataField="LastName" SortExpression="LastName" HeaderText="Last Name"></telerik:GridBoundColumn>

 

 

 

 

 

<telerik:GridBoundColumn DataField="DOB" SortExpression="DOB" DataType="System.DateTime" HeaderText="Date of Birth"></telerik:GridBoundColumn>

 

 

 

 

 

</Columns>

 

 

 

 

 

<NoRecordsTemplate>

 

 

 

 

No Records Available

 

</NoRecordsTemplate>

 

 

 

 

 

 

</MasterTableView>

 

 

 

 

 

<ClientSettings>

 

 

 

 

 

<ClientEvents OnCommand="RadGrid1_Command" />

 

 

 

 

 

</ClientSettings>

 

 

 

 

 

</telerik:RadGrid>

 

 

 

 

 

 

<script type="text/javascript" >

 

 

 

 

 

 

 

function LoadGridData()

 

{

 

var pageSize = $get("<%= ddPageSize.ClientID %>").value;

 

 

var tableView = $find("<%= RadGrid1.ClientID %>").get_masterTableView();

 

 

var currentPageIndex = tableView.get_currentPageIndex();

 

 

var sortExpressions = tableView.get_sortExpressions().toString();

 

 

 

var gridPageSize = tableView.get_pageSize();

 

PageMethods.GetData(

"", "", gridPageSize, 1, OnLoadDataSuccess, OnLoadDataFailed);

 

 

}

 

function OnLoadDataSuccess(e)

 

{

 

var grid = $find("<%= RadGrid1.ClientID %>");

 

 

if (grid != null)

 

{

 

var tableView = grid.get_masterTableView();

 

tableView.set_dataSource(e.Rows);

tableView.set_virtualItemCount(e.TotalRowCount); //Here is where the exception is generated. In the debugger

tableView.dataBind();

}

}

0
Roatin Marth
Top achievements
Rank 1
answered on 23 Nov 2008, 12:07 AM
Tags
Grid
Asked by
Elton
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Brett Howard
Top achievements
Rank 1
Roatin Marth
Top achievements
Rank 1
Share this question
or