PDA

View Full Version : [CLOSED] Remote Paging using Store



iansriley
Oct 30, 2014, 4:48 PM
Hi Danil,

I have been using remote pagination to achieve the database pagination,

we have a search button that will pull up only the records based on my search criteria and startIndex and EndIndex of the page index records..

However, this is been working fine for next,last etc....

But not working when we are in different page index..,

Let's consider when i switch to 3rd page or any other page except first Page.. then again Search with different criteria using search button ,
we noticed that e.Start will remains same even after click on search button, expecting that it is reset to 0 value for new search..

i have used store1.reload() to refresh store..


here is the code :




<ext:Store ID="store1" runat="server" RemoteSort="false" AutoLoad="true"
PageSize="50" OnReadData="store1_RefreshData" WarningOnDirty="false">
<AutoLoadParams>
<ext:Parameter Name="start" Value="0" Mode="Raw" />
<ext:Parameter Name="limit" Value="50" Mode="Raw" />
</AutoLoadParams>
<Proxy>
<ext:PageProxy />
</Proxy>
<Model>
<ext:Model ID="Model5" runat="server" >
<Fields>
<ext:ModelField Name="company" />
<ext:ModelField Name="Price" />
<ext:ModelField Name="Location" />
</Fields>
</ext:Model>
</Model>

</ext:Store>


<ext:Button ID="btnSearch" runat="server" Text="Search" Width="80">
<Listeners>
<Click Handler="App.direct.Search()" />
</Listeners>
</ext:Button>


<ext:GridPanel Id="GridPanel1" runat="server" >

Columns......

</ext:GridPanel>


Server Code :




Public StartIndex As Integer = 1
Public LastIndex As Integer = 51
Public TotalRecordCount As Integer = 0
Public Sub store1_RefreshData(ByVal sender As Object, ByVal e As StoreReadDataEventArgs)

StartIndex = e.Start
LastIndex = e.Start + e.Limit + 1
SearchData(StartIndex,LastIndex)
Dim p As PageProxy = storeRecipients.Proxy(0)
p.Total = TotalRecordCount
End Sub
<DirectMethod> _
Public Sub Search()
store1.Reload()
End Sub
Public sub SearchData(ByVal stidex as Integer,ByVal ltIndex as Integer)
'' load logic .......
end sub


Please suggest me how to reset the e.Start on new search...

Daniil
Oct 31, 2014, 8:48 AM
Hi @iansriley,

Please replace

<Click Handler="App.direct.Search()" />
with

<Click Handler="App.store1.loadPage(1);" />

It also allows you to get rid of the Search DirectMethod and that excessive round trip to server.

iansriley
Oct 31, 2014, 9:26 AM
This is working fine, Thanks Danil,

mark the ticket as closed