[CLOSED] PagingToolbar get PageIndex

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [CLOSED] PagingToolbar get PageIndex

    Hi
    How do I get the PageIndex of a PagingToolbar, this was possible in older version, but I can't find the property any more?

    Regards
    Mikael
    Last edited by fabricio.murta; Feb 13, 2020 at 11:40 PM.
  2. #2
    Hello @Jurke!

    Do you mean the current page the pager is in? Or is it something else related to the page?

    If that's the current page, you should get it off the related store instead. If you already have the paging toolbar handy in your code and don't want to go thru the trouble to get the store off its grid, you can just call paging toolbar's getStore() method. It is not private, so you are guaranteed at least a breaking change notice if this ever changes in the future.

    Once you have the store, you can then get the page by its currentPage property.

    If you really, really want to get the current page (and other page data), you can use the paging toolbar's private getPageData() method. It will return an object with a currentPage member which you can use and should match the store's.

    I am assuming you want to get the page from client-side. If you have a specific condition, it always helps to present a test case or an Ext.NET Examples's sample pointing then where exactly in the code you need to get the information. In some circumstances, from server-side, you need to "post back" the value you need, so there's little I can guess from the inquiry you currently presented.

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Hi
    Sorry for being unclear, in the old code I could the the current page number in code behind with this property
    PagingToolbar1.PageIndex. But that does not work any more. Is it possible to get the current page number in code behind in a DirectEvent?

    Regards
    Mikael
  4. #4
    Hello Mikael,

    Okay, I got it. I found one example that used it, and now we can see how it does the same task. Please compare these two examples:

    - Form > Miscellaneous > Edit_Form_View in Ext.NET Examples 1
    - Form > Miscellaneous > Edit_Form_View in Ext.NET Examples 5

    Check how the DeleteClick() code-behind handler changed. I believe you may be able to apply the same change in your version.

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert
  5. #5
    Hi
    I can't implement this because in this case there is only one row, so the index of the datasource will be the same as pageIndex. I my case I have a Grid with several rows, so one page contains x rows.
    Maybe there is another way to do what I want. I want to cycle the pages automatically in the Gridpanel, this page is for showing data on a TV-screen, and if there is more than one page it should cycle them through.
    I did this manually with a timer and with the PageIndex in the old Ext. version.

    Regards
    Mikael
  6. #6
    Hello Mikael,

    Can't you think a test case that could highlight how the data view looks like, and describe what you need to achieve in it, so we may better aid you in the issue?

    By the description you provided, it seems best rely on client-side code instead of always calling server just to advance a page in the list of entries, so instead of guesses I believe we would best switch to sample case, to allow us to provide you better advice.

    Maybe this example would be a good starting place: DataView > Basic > With_Paging

    Looking forward to your follow-up!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Replies: 2
    Last Post: Oct 09, 2018, 9:06 PM
  2. [CLOSED] How to get current the PageIndex?
    By blueworld in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 28, 2013, 11:04 AM
  3. [CLOSED] PagingToolbar (pageindex) not updating
    By mcfromero in forum 1.x Legacy Premium Help
    Replies: 14
    Last Post: Mar 20, 2012, 7:36 PM
  4. PagingToolbar.PageIndex doesn't work
    By YuanChien in forum 1.x Help
    Replies: 2
    Last Post: Jul 20, 2011, 7:22 AM
  5. reset gridpanel pageindex to 0 after new filter
    By javadzarrin in forum 1.x Help
    Replies: 1
    Last Post: Aug 22, 2010, 8:29 AM

Posting Permissions