UniGrid, Filter and Paging Custom Webpart

Brenden Kehren asked on March 6, 2014 21:37

I have a custom webpart that uses a unigrid and is using the "filter" alternate form to filter data. I also have paging enabled. All works well for the most part EXCEPT if I submit the filter and then navigate to the next page. When I navigate to the next page, the filter is lost. How do I re-apply that filter?

Correct Answer

Roman Koníček answered on April 24, 2014 09:19

Hi Brenden,

Could you please go to Site Manager -> Settings -> System -> User Interface and double check that Remember listing, filter and state option is enabled?

Best Regards, Roman Konicek

0 votesVote for this answer Unmark Correct answer

Recent Answers

Stefan Lorenz answered on June 11, 2014 06:56

Hi Roman,

can you tell me how to remove (parts) of the current state of a UniGrid? I have a UniGrid on a page that is populated in Page_Load() with .OrderBy("NodeLevel, NodeOrder,NodeName") to ensure backend sorting by default. If users click on a column header, the sorting changes to that column. But I'd like to give users the ability to switch back to "system" sorting somehow without closing the browser.

Best regards, Stefan

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on June 11, 2014 07:05 (last edited on December 10, 2019 02:30)

A simple solution would be to give them a link to click on that would redirect them back to the page they are currently on. You could use a macro in an editable text box <a href="{% CMSContext.CurrentDocument.NodeAliasPath |(identity)GlobalAdministrator%}">Click here to reset</a>

0 votesVote for this answer Mark as a Correct answer

Martin Hejtmanek answered on July 23, 2014 09:33

Hi Stefan,

You have several options depending on what you need:

  • The easiest way to just reset the ordering state (and no other states) programmatically would be probably to just call this:

grid.SortDirect = grid.OrderBy;

  • The grid also has a Reset() method that can be used to reset the whole state including filter, you can call this method programmatically, too

  • If you want to leverage the default Reset button in a grid filter, you can set the property FilterLimit of the grid, so that the filter displays immediately and the reset button is available. This button calls the Reset method I mentioned above

grid.FilterLimit = 1;

Let us know if you need some more details

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.