Jul 23, 2010, 7:09 PM
[CLOSED] Switching DataSource of GridPanel store causing problems with paging
I'm using remote paging/sorting. All of that is working well, but occasionally, I need to change the datasource that the store is reading from. If I've changed my page to something >1 then it's possible that I can get the situation where my current page is greater than the total number of pages. What I need to do is reset the paging start value when the datasource is changed. Here's part of the code that I'm using:
I'm trying to switch the datasource on my grid using something like the following. The actual changing of the datasource is working fine. I just need to put something in the DataBind so that the page number is set back to 1. How can I do this?
I'm trying to switch the datasource on my grid using something like the following. The actual changing of the datasource is working fine. I just need to put something in the DataBind so that the page number is set back to 1. How can I do this?
Public Overrides Sub DataBind()
'Clear out grid and reset paging
End Sub
Public Sub Store_Refresh(ByVal sender As Object, ByVal e As Ext.Net.StoreRefreshDataEventArgs)
Dim stuff As New List(Of Object)
For i = 1 To 1000
stuff.Add(New With {.foo = "Row " & i})
Next
e.Total = stuff.Count
'Handle sorting
stuff = stuff.Skip(e.Start).Take(e.Limit)
Store1.DataSource = stuff
Store1.DataBind()
End Sub
Last edited by geoffrey.mcgill; Jul 24, 2010 at 4:43 AM.