Basic Example 3 - Multi-column Ordering obtuse

Basic Example 3 - Multi-column Ordering obtuse

brotherbillbrotherbill Posts: 3Questions: 0Answers: 0

In http://datatables.net/examples/basic_init/multi_col_sort.html, you have the following text:

"The example below shows the first column having a secondary order applied to the second column in the table, vice-versa for the second column being tied directly to the first and the salary column to the first name column."

This is incredible obtuse. What is it that you are trying to accomplish here? I can understand sorting by Last Name, then First Name, then Salary.

But in this example, this seems rather obtuse.
To me, this means:
For first column of Last Name, the sequence is major first column Last Name, minor second column First Name.
For second column of First Name, the sequence is major First Name, then minor Last name (This makes no sense).
For Salary column, the sequence is major Salary column, then First Name column.

What does it mean "tied directly"?

This makes no sense.
Again, I think what is sought is sort by Last Name, then First Name, then Salary.

I have no idea why the configuration for this is so complex.

Given that this is the third example in the basic series, I would expect that a beginner to datatables.net ought to be able to follow it.

Please help me to understand this, and then to consider updating the example, or update the explanation of the example.

Replies

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395
    edited May 2014

    I have no idea why the configuration for this is so complex.

    The "configuration" is to be found in the javascript for the example, which doesn't look complex to me. Have you actually tried using the example? You might find that understanding arrives more quickly with a hands-on approach.

  • brotherbillbrotherbill Posts: 3Questions: 0Answers: 0

    Hi Tangerine. Can you explain in layman's terminology what the javascript is telling datatables.net to do as far as sorting. You read my thoughts.

    Can you explain the javascript code, in English?

    Thank you.

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Let's ignore the last column for the moment - that is just there as an example - nothing else.

    So the Javascript is saying that column 0 will be sorted on columns 0 and 1. Column 1 will be sorting on 1 and 0 (in that order).

    The sorting might not be what you are looking for from the table, but it is just an example trying to show how it can be customised. I will look into improving the text for that example - thanks for bringing it up.

    Allan

  • brotherbillbrotherbill Posts: 3Questions: 0Answers: 0

    It just seems awkward. I am accustomed to describing sort fields major to minor, which of course, you support.

    But to say that column 0 is sorted on columns 0 and 1,
    then column 1 is sorted by columns 1 and 0 seems totally foreign to me.

    What would be helpful is to have sufficient data in the table, so that these configurations can handle these different situations where sorting major to minor is insufficient.

    After all, if sorting major to minor is sufficient, why add such a difficult to understand mechanism.

    If it actually serves a need, a step by step tutorial, explaining how this feature satisfies an advanced requirement, not met by major to minor support.

    If it truly is a rarely used advanced technique, perhaps it should not be the third example under Basic Initialization section, and instead being reserved for advanced techniques.

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    edited May 2014

    But to say that column 0 is sorted on columns 0 and 1, then column 1 is sorted by columns 1 and 0 seems totally foreign to me.

    Fair enough. If you want them consistently to sort 0 to 1 or 1 to 0 just change the code for your use case.

    After all, if sorting major to minor is sufficient, why add such a difficult to understand mechanism.

    What would you change about it? I can't see how it could be any simpler when it needs to be able to define any column in any order. An array of indexes is as simple as I could figure it - unless I'm missing something?

    Allan

This discussion has been closed.