scrollY with individual column searching (text inputs) in the header and set the value of the input - Page 2

scrollY with individual column searching (text inputs) in the header and set the value of the input

2»

Answers

  • gridgrid Posts: 32Questions: 4Answers: 0
    edited January 2020

    Hello Kevin,

    Yes works. Because of testing to another page (mistake); see now that searching like described above works by adding inputs after initialization. It's alright.

    This test page has colvis and header inputs http://live.datatables.net/dikuduka/1/edit
    When you show/hide a column it will keep the value in the header input. Is that possible to do with scrollx, colvis and statesave?

    Thanks,

    Mark

  • kthorngrenkthorngren Posts: 21,336Questions: 26Answers: 4,951
    Answer ✓

    Are you asking about keeping the input value from StateSave? If so there ae many threads regarding this such as this one:
    https://datatables.net/forums/discussion/56943

    Kevin

  • gridgrid Posts: 32Questions: 4Answers: 0

    Kevin,

    No. I believe they mean when the page is reloaded. I mean just keeping it in the input value. In this page http://live.datatables.net/dikuduka/1/edit there is no statesave but it will still remember the input value when you show/hide a column. In this example it doesn't: http://live.datatables.net/nodiquve/1/edit

    Thanks,

    Mark

  • kthorngrenkthorngren Posts: 21,336Questions: 26Answers: 4,951
    Answer ✓

    You need to use a similar technique. The code adds an input to the hidden column that is becoming visible. You will then need to update the input value with the current search term, such as this:

            var searchVal = table.column( column ).search();
            if (searchVal !== '') {
              $(rowTwoTH).find('input').val(searchVal);
            }
    

    I added this code to the first table's $('#example').on( 'column-visibility.dt', event handler here:
    http://live.datatables.net/nodiquve/4/edit

    Kevin

  • gridgrid Posts: 32Questions: 4Answers: 0

    Hello Kevin,

    Yes thanks. Exactly what I was looking for.

    Mark

This discussion has been closed.