sorting in real time

sorting in real time

yuvalweyuvalwe Posts: 1Questions: 1Answers: 0

Hi Everyone

I'm using a datatable that is not using ajax, and I need the ability to re-sort the columns as they are changed by the client.
I tried fnDraw but it doesn't work.

Is It Possible?

Answers

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75

    The fnDraw you linked to is legacy anyways, are you working with Legacy DataTables.. If so, im not sure you would get much support for that... "Updating to 1.10+ is recommended if you haven't already."

    You said "re-sort the columns", do you mean sort the content "like what clicking on the header would do), or re-order the columns as in moving the entire column from right to left?

    If its the former, then thats a lot easier to take care of.

    First, I would highly recommend you switch to either ajax or atleast a JSON DataSource, as then you can just use ajax.reload() or reload the table with whatever new JSON source you may have, and as long as it pulls it in the right order, it will display it in that order (if you dont sort anything by default)

    Doing it in the DOM would be a pain in the butt. but im sure its possible.

  • allanallan Posts: 62,312Questions: 1Answers: 10,225 Site admin

    Using fnDraw should work just fine - it simply maps to the new draw() method (although I would recommending using the new API if you can).

    If the draw method isn't working for you we'd need to know how you are updating the table to understand why it isn't working. This is why the forum rules ask for a test case to be providing showing the issue - could you please link o the page.

    Thanks,
    Allan

This discussion has been closed.