Show/Hide option; State saving

Show/Hide option; State saving

baron85baron85 Posts: 11Questions: 0Answers: 0
edited November 2010 in General
Is there some possibility to add a State Save function to the show/hide details option??
Also i would like to know if it's possible to close one field when another one is opened and if this
can be done by clicking the row instead of the + - image?

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Yes this is possible on all accounts:

    1. State save - what would need to be done is to utilise the cookie callback functions ( http://datatables.net/usage/callbacks ) to save the information needed in the state saving cookie. The loading callback can then be used to restore that state.

    2. Close one field - what you could do is find any rows which are currently open, and then simply close then. This can be found using either DOM methods or the internal API in DataTables.

    3. Row click - simply alter the selector used to attach the event handler to match the TR elements rather than the IMG elements.

    Allan
  • baron85baron85 Posts: 11Questions: 0Answers: 0
    Hi Allan,

    Thnx for replying. I've solved the row click problem, was easy. I've tried to figure out how to utilise the cookie callback function, but I don't really understand what to do with it... Also the Close one field method is not making sense to me. Can you point me in the right direction??

    Bye for now
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Close one field:
    [code]
    $(oTable.fnGetNodes()).each( function () {
    oTable.fnClose( this );
    } );
    [/code]
    It could be optimised somewhat but it will work.

    With the cookies, the easiest way to understand them is to try implementing the examples. It's probably one of the most advanced bits of DataTables initialisation that :-)

    Allan
This discussion has been closed.