Sunday, March 30, 2014

Preserving Grid State in KendoUI

Continuing from the last post about preserving tab state, next up is automatic, universal grid state preservation. The state could be stored to the session, but then code has to be added server side for each Ajax endpoint. That's not possible of the grid is polling a third party service as well. It's better to handle it all client side with local storage.

The script will wrap around the grid constructor and setup events to capture the state. It also checks if you wish to use local or session storage in the browser. Local storage persists across browser closes while session won't. Both are useful for different situations.

Currently, only a limited state is captured:
  • Page
  • Page size
  • Sorts
  • Filters
  • Grouping
Other options like visible columns are not stored.

The jquery extension for local storage is just a slightly modified version of Marcus Westin's store.js. Modified to attach to jquery and allow selection between local and session storage.

1 comment:

  1. Once you create an account and log in, you will discover a slew of welcome bonuses to select from. Indeed, the most valuable one is the 320% slots bonus you could get by entering the REDCOIN code. You can use over 20 payment strategies, together with American Express, MasterCard, Visa, and Money Orders, in addition to 17 cryptocurrencies. As a high playing site, Ignition works with variety of the} best game providers within the trade, together with Spinomenal, Red Tiger Gaming, and Betsoft. Australia’s monetary crimes watchdog AUSTRAC has ordered an audit of main sportsbooks Sportsbet and Bet365 to assess their compliance with anti-money laundering and counter-terrorism financing rules. According to data introduced by AUSTRAC this 1xbet week, its actions are end result of|the outcomes of}...