Multi Column Sort Functionality

Multi Column Sort Functionality

Michael GraciMichael Graci Posts: 5Questions: 1Answers: 0

Hi

Just exploring at this point and then would probably go for advanced support. if there is a fit.

From a functional perspective in regards to Multi Column Ordering--I want to make sure the functionality matches my goal.

In the data table I have...the goal is to have several multi column queries in play for a given table at once. So for example the table might contain 10 columns (or 30 columns of data)..here is (a made up example) of what I am trying to do within a given table...

Search on column1 (Name)...then by column3 (State)...then by column5 (Date of register)

On the same table I might also have

Search on column5 (Date of register)...then by column1 (Name)

etc.
etc.

Should I be able to achieve this functionality with that add-on?

Thanks
Mike

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    Hi Mike,

    DataTables supports multi-column ordering out of the box. The end user can "shift click" a column header to add it to the column ordering. You can also use order() if you want to trigger it programmatically, or use columns.orderData if you want to trigger multi-column ordering when the user selects a column.

    Allan

  • Michael GraciMichael Graci Posts: 5Questions: 1Answers: 0

    Hi Allan

    First thanks for writing. I see what you wrote (and see it on the Examples page). I tried that on the "Examples page"-- but i didn't see it having any affect on the data...do you know of a test to run that demonstrates its functionality on the Example Page?

    What I am most trying to understand is "would I be able to write code" to not be dependent on "shift click".. and have the sort feature embedded in the table functionality...so when i do a regular click on a column table ---it does the query "by the order I laid out" -- example being "sort by Column1, then column3 then column5.

    Hope that make sense. My intent here is find out if this feature can provide the desired functionality --them I am going to have a developer work with this ..to flesh it our in the overall design.

    Thanks
    Mike

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

    Hi @Michael Graci ,

    Yep, as Allan said the order() is done programmatically, so within the code, so the user wouldn't be required to "shift click" or do anything, the table will be displayed with the multi-column ordering that the programmer applies. The DataTables API is extensive, you can disable or modify the user functionality to suit what you want your app to do.

    Cheers,

    Colin

  • Michael GraciMichael Graci Posts: 5Questions: 1Answers: 0

    Thanks Collin and Allan...i was able to get the "shift click" to work. Will dable with code next.

    Appreciate your response.

    Mike

This discussion has been closed.