Home General Discussion

Change Active Work grid items/page

Adrian_MataiszAdrian_Mataisz Customer Advanced IT Monkey ✭✭✭
edited June 2016 in General Discussion

How we can change the default # of items  displayed per page in the grid?  Default is set to 20, I always change to 100 but I would like to hardcoded by default to 200 at least. I also would like to see the page crumbs menu on top, to scrool down to the bottom is not very time efficient.


Thank You

Comments

  • Adrian_MataiszAdrian_Mataisz Customer Advanced IT Monkey ✭✭✭
    Thanks. I'll try this. What I have to add to the code to have the  pagination section on top as well as bottom of the page/grid?
  • Adrian_MataiszAdrian_Mataisz Customer Advanced IT Monkey ✭✭✭
    Nicholas_Velich   can pagination numbers be inserted before and after the grid?
  • Nicholas_VelichNicholas_Velich Cireson Consultant Ninja IT Monkey ✭✭✭✭
    Possibly, but I don't have an answer at this very moment.

    insertBefore() is being used now (line 8) which moves the pagination element. You would need to find a different method which copies/clones the element instead of moving it.
  • Jerry_VeldhuisJerry_Veldhuis Customer Advanced IT Monkey ✭✭✭

    Good solution @Nicholas_Velich but two relatively minor issues that you may want to be aware of:

    1. When the page reloads the page flashes as the pager gets relocated
      Instead of the setTimeout, is there a way to trigger off when the grid is added to the page ?
    2. you code sets the value of the page size upon page load which is a behavior change. OOB if the user changes the page size it sticks even when they navigate away/back.

    I'll let you know if I find solution to these.

  • Nicholas_VelichNicholas_Velich Cireson Consultant Ninja IT Monkey ✭✭✭✭
    edited July 2016
    Hi Jerry,

    Thanks for the feedback! This is more of a proof of concept rather than a polished solution, so it can definitely be improved further.

    For (1), you could potentially do something similar to what @joivan_hedrick did here.

    For (2), I don't know that there is a "is default still set" we can look to for the pagination, but you could potentially look to see if the user had any existing filters, groupings, sorting, etc, and only apply the 200 per page setting if all those other defaults were still selected (that would get you closer anyway). For example, looking to see if the user has made a custom filter would be done like this:

    if($(this).data('kendoGrid').dataSource._filter == null){
            // If we are in here, that means the user never applied any kendo filtering elements. The code to change the pagination would then go here.
    }

    Thanks,
    Nick
  • Roelof_LuingeRoelof_Luinge Customer IT Monkey ✭
    edited September 2019

    Hi,


    I changed a little bit in the code so it counts for all views. But now, if a user changed the default, every time after reloading the page it is set back to 50. Is there a way to solve this?

    My changed piece of code:

    if(url.indexOf("/View/") > -1){ // Verify we are on ta View page

Sign In or Register to comment.