Hi,
I'm trying to implement virtual scrolling, and it's working great, except that the currentpageindex doesn't update immediately.. I open the page, and it loads page 0. Then I scroll down, the loading symbol shows, it displays data - same data as page 0. If I hit 'refresh', it then loads the correct data. Or, if I scroll down another page (so now the pager says I'm on page 2) it updates and shows me the page 1 data - it's one page behind. Did I miss a rebind call? I'm using NeedDataSource, though, and so I don't need to put that in there, right?
Here's my radgrid tag:
And my vb NeedDataSource function:
I looked at this thread but it did not fix my issue, as well as various documentation for paging and virtual scrolling, and haven't found a solution yet. Thanks in advance for any advice!
I'm trying to implement virtual scrolling, and it's working great, except that the currentpageindex doesn't update immediately.. I open the page, and it loads page 0. Then I scroll down, the loading symbol shows, it displays data - same data as page 0. If I hit 'refresh', it then loads the correct data. Or, if I scroll down another page (so now the pager says I'm on page 2) it updates and shows me the page 1 data - it's one page behind. Did I miss a rebind call? I'm using NeedDataSource, though, and so I don't need to put that in there, right?
Here's my radgrid tag:
<telerik:RadGrid |
id="RadGrid1" |
runat="server" |
ShowGroupPanel="True" |
GridLines="None" |
PageSize="20" |
AllowPaging="True" |
AllowCustomPaging="True" |
AllowSorting="True" |
GroupingEnabled="True" |
Height="625px" |
EnableViewState="True" |
> |
<PagerStyle Mode="NumericPages" /> |
<MasterTableView |
DataKeyNames="id_col" |
AllowMultiColumnSorting="True" |
AutoGenerateColumns="False" |
CommandItemDisplay="Top" |
ShowHeadersWhenNoRecords="True" |
ShowFooter="true" |
> |
<CommandItemSettings ShowAddNewRecordButton="False"></CommandItemSettings> |
<Columns> |
<telerik:GridBoundColumn Visible="False" DataField="name" HeaderText="Name" UniqueName="name"></telerik:GridBoundColumn> |
<telerik:GridBoundColumn Visible="False" DataField="classname" HeaderText="Class Name" UniqueName="classname"></telerik:GridBoundColumn> |
<telerik:GridBoundColumn Visible="False" DataField="identifier" HeaderText="Identifier" UniqueName="identifier"></telerik:GridBoundColumn> |
</Columns> |
</MasterTableView> |
<GroupingSettings ShowUnGroupButton="True"></GroupingSettings> |
<SortingSettings SortToolTip="name" /> |
<ClientSettings AllowDragToGroup="true"> |
<Scrolling |
AllowScroll="True" |
EnableVirtualScrollPaging="True" |
UseStaticHeaders="True" |
SaveScrollPosition="True" /> |
</ClientSettings> |
</telerik:RadGrid> |
And my vb NeedDataSource function:
Protected Sub RadGrid1_NeedDataSource(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource |
Dim sql As String |
Dim cmd As OracleCommand |
Dim row_count As Integer = 1 |
' Open connection |
conn.Open() |
' Set up sql command |
sql = "db_search" |
cmd = New OracleCommand(sql, conn) |
cmd.CommandType = CommandType.StoredProcedure |
' Add parameters |
cmd.Parameters.Add("row_start", OracleDbType.Decimal, RadGrid1.CurrentPageIndex * RadGrid1.PageSize, ParameterDirection.Input) |
cmd.Parameters.Add("row_end", OracleDbType.Decimal, (RadGrid1.CurrentPageIndex + 1) * RadGrid1.PageSize, ParameterDirection.Input) |
cmd.Parameters.Add("db_cur", OracleDbType.RefCursor, ParameterDirection.Output) |
' Get row count (cut out this part for brevity, it does update it though) |
Me.RadGrid1.VirtualItemCount = row_count |
' Set as the datasource |
Dim da As New OracleDataAdapter(cmd) |
Dim ds As New DataSet() |
da.Fill(ds) |
Me.RadGrid1.DataSource = ds |
' Cleanup |
da.Dispose() |
ds.Dispose() |
conn.Close() |
End Sub |
I looked at this thread but it did not fix my issue, as well as various documentation for paging and virtual scrolling, and haven't found a solution yet. Thanks in advance for any advice!