bState: remember the sorting - forget the filter

bState: remember the sorting - forget the filter

justStevejustSteve Posts: 49Questions: 8Answers: 1
edited May 2010 in General
I'm looking to arrange the cookie settings so things like which column (and which direction) was sorted but clear the filter property - not just at a page refresh - i have use cases where i'd like to clear the filter in response to some event within the given pageview.

Does bServerSide: true/false come into play here?

thx

Replies

  • allanallan Posts: 63,161Questions: 1Answers: 10,406 Site admin
    Hi justSteve,

    Okay, so you want to be able to have DataTables remember everything but the filtering state? Unfortunately DataTables doesn't currently allow the cookie to be manipulated in quite this way - it's either all or nothing. It's something I've been thinking about providing options for in future, and I've put it on my to-do list now, but that's not an immediate solution...

    What you could do is have state saving enabled, and then when the table loads run fnFtiler(''); which will clear the filter. So it would flicker from the saved filtering state to the unfiltered state - but should be so fast that it can't be seen. How does that sound as something for "right here, right now"?

    Regarding bServerSide - that is for server-side processing:
    http://datatables.net/usage/#data_sources
    http://datatables.net/development/server-side/

    Regards,
    Allan
  • justStevejustSteve Posts: 49Questions: 8Answers: 1
    Much appreciated. - i'm pretty sure 'fnFtiler' is a typo but site search isn't returning anything to fnFilter either.

    Is there an event to tie this to prior to the table load? I'm thinking if i'm processing server-side it would result in 2 hits against the server unless i can clear at whatever the tableUnload event is called.

    ...actually...thinking about it ... my use case will is:

    1) load the table filtered to a specific search condition (user needs to find that needle in a haystack)
    2) wait for a click to checkbox (delighted at the awesomeness of autocomplete, the user makes his selection)
    3) reload the unfiltered page ready to deliver more delight

    my code should have plenty of opportunity to zero-out the text-box holding the search term.

    thx - always happy to add to someone's to-do list. [it's a gift] ;)
  • justStevejustSteve Posts: 49Questions: 8Answers: 1
    /palm -> forehead....if i hadn't introduced my own typo i would have found fnFilter before embarrassing myself. in rosanne rosanadana's immortal words....never mind.
  • allanallan Posts: 63,161Questions: 1Answers: 10,406 Site admin
    Hi justSteve,

    Yup sorry - a typo there - fnFilter ( http://datatables.net/api#fnFilter ) :-)

    You can also use fnInitComplete ( http://datatables.net/usage/callbacks#fnInitComplete ) to run code after the table has been initialised.

    Regards,
    Allan
This discussion has been closed.