Ajax SearchPanes options and server side is not working

Ajax SearchPanes options and server side is not working

coolblades1coolblades1 Posts: 26Questions: 2Answers: 0

Hi,
I just upgraded to version 2.0 from 1.4.0 and now my search panes are showing empty.
I traced the problem to searchPanes option viewTotal,
if I set it to true in 2.0 then the searchPanes are populated even the doc say it should not be turned on:

"Note: When loading SearchPanes options over ajax, but then using serverSide processing, neither searchPanes.viewTotal or searchPanes.cascadePanes are supported. This is due to the requirements for users to provide accurate data for the SearchPanes options, whose values change when using these two options. While it is still possible to enable these options, it is not advised and may lead to unexpected behavior."

When I turned viewTotal on I do get other are errors, I didn't try to dig into that since it is not suggested to be on anyway.

Maybe in this example you can try to have serverSide true and without viewTotal and see if you can get the same thing as I am getting.
https://datatables.net/extensions/searchpanes/examples/initialisation/ajaxOptions.html

Thanks

Answers

  • sandysandy Posts: 913Questions: 0Answers: 236

    Hi @coolblades ,

    Sorry, I'm a bit confused! Are you loading the option over ajax and using server side processing while searchPanes.viewTotal is enabled? If so, that is not supported, as you have highlighted.

    If not, could you please link to a test case showing your issue? Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Thanks,
    Sandy

  • coolblades1coolblades1 Posts: 26Questions: 2Answers: 0

    No I didn't turn on viewTotal and this result in empty search panes.

  • coolblades1coolblades1 Posts: 26Questions: 2Answers: 0

    Ok, I think I found the issue, I have ajax as function but with url undefined when table was initialized and then I update the ajax url later and call draw, this apparent cause search panes to get initialized to empty. It was ok in 1.4 version.

    On the side note, the DT row select color is broken for bootstrap 3
    https://jsfiddle.net/p7cyed2x/3/
    if you select a search option, you get white on white, this true of the main table too if you have selection turned on.

  • coolblades1coolblades1 Posts: 26Questions: 2Answers: 0

    Another note, I noticed that ajax is called 2 times on dt init even if I don't have any filter selected, should it just do 1 call in this case?

  • coolblades1coolblades1 Posts: 26Questions: 2Answers: 0

    I gave up on version 2.0 with stateSave, serverSide on. It just won't behave right for me, I tried to update the fiddle js but could get the stateSave to turn on there for some reason. I will stay at 1.4 for now....

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Thanks for post. We'll get back to you in a couple of days when Sandy is next in,

    Colin

  • sandysandy Posts: 913Questions: 0Answers: 236

    Hi @coolblades1 ,

    I'm afraid that to debug this properly we will need to see a test case, as I mentioned above.

    Why are you changing the ajax url? This isn't something that we would expect to be necessary...

    Thanks,
    Sandy

  • coolblades1coolblades1 Posts: 26Questions: 2Answers: 0

    Ignore the changing the ajax url, the problem still exist with stateSave, serverSide both on.
    Unfortunately I can't get the jsfiddle to work with stateSave in my example, feel free to play with it.

  • coolblades1coolblades1 Posts: 26Questions: 2Answers: 0

    Ok, I got the stateSave to work in my jsfiddle example and it seems to be working. I will need to go back my real work and see why it is not working there.
    This is can be closed.
    Thanks

  • coolblades1coolblades1 Posts: 26Questions: 2Answers: 0
    edited March 2022

    Ok, I think I got the test scenario for you to try:
    https://jsfiddle.net/t925g64y/3/

    Steps:
    1. Run
    2. Select London and you will see london is selected and datatable has 2 entries
    3. Run again, you will see filters are restored to what you have selected (London) and dt has two entries
    4. Unselect London, and you will see dt has all the data again but search panes are not updated despite it is specified in the echo result

    I hope this contrived example demonstrated the issue I am encountering...

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Thanks for test and the steps. Sandy will take a nose when he's back in towards the end of next week,

    Colin

  • sandysandy Posts: 913Questions: 0Answers: 236

    Hi @coolblades1 ,

    It looks to me as though you are trying to implement your own version of searchPanes.cascadePanes - I would advise that you use our code to do this rather than your own.

    From what I can see in that example, you are loading the options over ajax, with serverSide enabled and trying to dummy searchPanes.cascadePanes, which is not supported. You can use serverSide with searchPanes.cascadePanes though - take a look at this example.

    Thanks,
    Sandy

  • coolblades1coolblades1 Posts: 26Questions: 2Answers: 0

    ahh, thank you for point out my mistake of missing cascadePanes option!
    I was looking at https://datatables.net/extensions/searchpanes/examples/initialisation/ajaxOptions.html to try get my stuff to work, didn't realize I needed that option.

    Also the example you pointed is nice, I didn't know that example existed.

    Finally, I know this one problem not you area, did you see in my example when you select something in the table (seachPanes) you get white on white when using bootstrap 3 theme. This happens in main table too if selection is enabled....

  • sandysandy Posts: 913Questions: 0Answers: 236

    Hi @coolblades1 ,

    It looks to me to be a clash with the FixedColumns styling sheet. See this example with that part removed from your css file. I've raised an issue internally (DD-2511 for my reference) and will report back here when there is an update.

    Thanks,
    Sandy

Sign In or Register to comment.