Problems with change of columns when server side processing after reload of datatable

Problems with change of columns when server side processing after reload of datatable

harvy76harvy76 Posts: 4Questions: 2Answers: 0

Hello to forum,
Please, I have big trouble with colReorder with serverSide processing and use stateSave.
What is the problem?
If I made the initial load of dataTable by click to fetch Data button it looks OK, The sorting is OK, and the functions which change teh data in the field to anchor work fine and in console I see that it call only one saveState for save the state into DB. When I change the Column position for example id from 1st position to 3rd position after invoice number, it looks OK, but is call the stateSave two times.
But When I call the fetch Data by the button again, then the column name change position to basic position and the data stay on the new position, Unfortunately the function for change the data to anchor not change the right column, but the column by the column name, not by the column with right data. How it looks? The data with ID are in 3rd column, but the column name ID is on top of 1st column. even I see that loadState is called one time and saveState is called two times.
OK, So i try to push the button again and the name of column with ID changed the position to 2nd column and the data is still on 3rd. loadState called only one time, saveState called 2 times. When I click on the button fetchData the ID name of column move to 3rd column and function at this time run correctly and change the data to anchor. The loadState called only one time, saveState called two times again.
Please, can you help me with this? I can to find what I do bad.
Shall I run the script with debug script with write the resolution into DB?
Thanks a lot for help
Honza H

Answers

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    Hi @harvy76 ,

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. 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.

    Cheers,

    Colin

  • harvy76harvy76 Posts: 4Questions: 2Answers: 0
    edited January 2019

    Hello Colin, Thanks a lot for the answer, please, Where I can use json data?
    Because I have server side processing on the page.
    Unfortunately I can't to make the site as public. I can only make a copy with anonymized data for example on jsfidle.
    Thank you for help.
    Honza H

  • harvy76harvy76 Posts: 4Questions: 2Answers: 0

    Hello Colin,
    So, Now thanks a lot of your answer.
    1. Good point with debugger. There I can check the versions of DataTables.
    2. Change columns after reload datatable is OK now. I found that the problem was in LIST of columns in php ajax file with. I added there names of the columns from request which was sent via ajax and now it looks better.
    Thank you
    Honza H

This discussion has been closed.