Results 1 to 3 of 3

Thread: PagingToolbar goto page

  1. #1
    Ext User
    Join Date
    Feb 2008
    Posts
    2
    Vote Rating
    0
      0  

    Default PagingToolbar goto page

    Hi

    I'm very new to javascript and extjs but after going thru the guides and studing the examples I managed to put together a small test application with extjs/asp.net mvc/activerecord/nhibernate/nibernate.linq.

    I managed to create a grid with pagingtoolbar and also added a combobox for alpha paging so the user can fetch only the records beging with the selected alpha char or browse all the records with paging (paging is also enanbled for alpha chars).

    Now I would like to pass the record ID to my function that displays the grid in a window. The record ID should be passed to remote server together with the other parameters {start: 0, limit: 25, sort: 'Name', dir: 'ASC', alpa: 'a', recordId: recordId}.
    The remote server should check if recordId is set or > 1 and if yes then find out the page number using the limit parameter, fetch the data for that page and finally send back the json result.
    Now my question is if I return the following json:
    {totalRow: 125, start: 25, limit: 25, rows: [.....] } would the pagingtoolbar use that start parameter and according it set and display the pagenumber (in this example the page number should be 2 out of 5 pages)? If not is there some way to do it?

    Thx

  2. #2
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    133
      0  

    Default

    Why use a recordId parameter? That is what the start parameter is for.

  3. #3
    Ext User
    Join Date
    Feb 2008
    Posts
    2
    Vote Rating
    0
      0  

    Default

    'recordId' is the unique ID of the record that I'm searching for. If recordId is empty then the remote return 'limit' records from 'start' at first call this would be from 0 and 25 records.
    If 'recordId' isn't empty then the remote calculates the page number where the searched record with 'recordId' can be found and returns 'limit' number of records containing also the searched 'recordId' record and also it returns the 'start' parameter so that the client can calculate the page number.
    Let's say I have records in my db with recordId from 1-50. If I'm not searching for a record I will call store.load({params: {start: 0, limit: 25}}) and the remote returns the first 25 record.
    Now if I search for record with Id 30 I will call store.load({params: {start: 0, lmit: 25, recordId: 30}}).
    Now the remote calculates that record with Id 30 would be at page 2 so it returns start: 25 and the client can display that it's on page 2 and position on record with the searched recordId.
    The Id of the records isn't integer in my case, i just used for simplicity.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •