1. #1
    Sencha User
    Join Date
    Jul 2012
    Posts
    235
    Vote Rating
    0
    chandan.behura is on a distinguished road

      0  

    Default pagination for dynamic grid

    pagination for dynamic grid


    Hi,

    I have facing issue in Pagination of a grid having dynamic url to load the grid.

    I have to populate the grid based on some filter condition that i am passing to server through url.
    For first page in pagination it is giving me the correct no of records in the page as per my limit.
    But after clicking next(>) in the pagination bar the parameters are passing null and fetching all values as per my DB design.


    How i will apply my pagination here for the ulr?

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,000
    Vote Rating
    456
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Can you provide more info about your dynamic url and what is send in the header?

    The params should be sent each time based on your config.

    Scott.

  3. #3
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,593
    Vote Rating
    324
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    By 'dynamic URL' do you just mean request parameters? If you do then you can either use extraParams:

    http://docs.sencha.com/ext-js/4-1/#!...-setExtraParam

    or add the parameters in a beforeload listener:

    http://docs.sencha.com/ext-js/4-1/#!...ent-beforeload

  4. #4
    Sencha User
    Join Date
    Jul 2012
    Posts
    235
    Vote Rating
    0
    chandan.behura is on a distinguished road

      0  

    Default


    Quote Originally Posted by scottmartin View Post
    Can you provide more info about your dynamic url and what is send in the header?

    The params should be sent each time based on your config.

    Scott.
    dynamic url in the sence.......
    Actually i have some filter condition and on click of a button i hav to get the grid store based on the filter conditions with pagination.

    So for that i have loaded the store on the click action of the button.
    like.
    store.load({
    url:'./myGrid/store.view',
    params :<some parameter to pass trough url to server for the store to populate>
    })
    Then i have the pagination toolbar in my grid. and in the store i have simply mentioned pageSize:100,

    so after some fight i saw that for first page in the pagination it's all coming right but when i am clicking the next button/ refresh button present in pagination all the parameters going are null except the start and limit parameter that is for pagination.

    for first time the url is like:
    http://localhost:8080/myGrid/store.view?year=2012&cndition=All&
    start=0&limit=100


    but after clicking next in pagination:
    <http://localhost:8080/myGrid/store.view?year=&cndition=&start=100&limit=100>
    ****NOTE.I have not given the exact url as of now as i am unable to remember that one and don't have the codes with me for today.. my url just looks like that. In my next replay i can give the my code with the exact url.

    Thanks.

  5. #5
    Sencha User
    Join Date
    Jul 2012
    Posts
    235
    Vote Rating
    0
    chandan.behura is on a distinguished road

      0  

    Default


    Quote Originally Posted by skirtle View Post
    By 'dynamic URL' do you just mean request parameters? If you do then you can either use extraParams:

    http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.proxy.Ajax-method-setExtraParam

    or add the parameters in a beforeload listener:

    http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.Store-event-beforeload
    hey skirtle,

    I tried as u said but did not get the right way how to do that.
    actually in controller i am loading the grid store on click action of a button and passing the params through the url in that function of controller.I have the parameter variables in the controller.can u give some code base/any good link so that i can know how to apply that one.

    i am doing the bellow thing inside click event of a button:
    gridStore.load({
    url:
    params:

  6. #6
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,593
    Vote Rating
    324
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    Try:

    Code:
    var proxy = gridStore.getProxy():
    
    proxy.setExtraParam('year', 2012);
    
    gridStore.load();

  7. #7
    Sencha User
    Join Date
    Jul 2012
    Posts
    235
    Vote Rating
    0
    chandan.behura is on a distinguished road

      0  

    Default


    Quote Originally Posted by skirtle View Post
    Try:

    Code:
    var proxy = gridStore.getProxy():
    
    proxy.setExtraParam('year', 2012);
    
    gridStore.load();
    Will i do that thing in the click action of my button which is for populating the grid in my controller?

  8. #8
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,593
    Vote Rating
    324
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    @sencha.user. This thread had nothing to do with the DynamicGrid extension. It was a question about a dynamic URL, not dynamic fields. Do not hijack other people's threads.

    From a quick read of those other threads it appears that you have misunderstood the purpose of totalProperty. It does not cut up a response into pages, it just allows the paging mechanism to know how many pages they are. Responsibility for ensuring that the paging parameters are respected lies with your server.

    I suggest you spend some time learning how to use a normal grid before you embark on trying to do complicated things with a DynamicGrid.

Thread Participants: 2

Tags for this Thread