Date sorting not using orthogonal data

Date sorting not using orthogonal data

dthayerdthayer Posts: 2Questions: 0Answers: 0

Test Case: https://jsfiddle.net/0bh8mt3y/1/

I'm using your "Ultimate date / time sorting plug-in" along with orthogonal data, since my display contains both date and non-date text. I am providing the "sort" text using orthogonal data, but have confirmed that the data that is passed to the "detect" and "sort" functions of the plug-in is the "display" text, not the "sort" value. I understand why you look at the display text in cases where it just contains a date, but if there is orthogonal data, the "sort" value should be passed to the "detect" and "sort" functions, not the "display" value, otherwise it defaults to sorting by "string", which gives incorrect results. I have a workaround, but if you could fix the internal code to pass the correct value that would clean up my workaround code.

Thanks!

Replies

  • colincolin Posts: 12,887Questions: 0Answers: 2,198

    Yep, thanks for that test case, that's clearly showing the issue. I've raised it internally (DD-2314 for my reference) and we'll report back here when there's an update.

    Cheers,

    Colin

  • allanallan Posts: 54,886Questions: 1Answers: 8,602 Site admin

    You need to set the type parameter to be sort as well: https://jsfiddle.net/CloudTables/Lp3t5kdw/ . Otherwise the type detection that is run will run on the display data, which isn't what you want in this case.

    Allan

  • dthayerdthayer Posts: 2Questions: 0Answers: 0

    I was basing my usage off of your comment here, stating that the "type" should not be set, but is detected automatically. While this is an old post, it seems that setting the "type" is still not the best idea and that the base library should always using the "sort" option from the orthogonal setup, if defined.

    Is there a reason you wouldn't want to using "sort" when it is provided and "display" in all other cases automatically? What is the purpose of setting the "sort" value if it is going to be ignored by the date sorting plugin?

  • allanallan Posts: 54,886Questions: 1Answers: 8,602 Site admin

    Ah - my comment there was about not setting the columns.type option. Not the type rendering object. The overlapping naming doesn't help - sorry!

    Is there a reason you wouldn't want to using "sort" when it is provided and "display" in all other cases automatically?

    Yes - the type detection can effect the filtering as well. Consider for example a date which is also a link. You want to be able to search by the rendered date string (without the HTML a tags) and sort by a number.

    Really what we should probably do is remove the generic type and have a different type for each orthogonal structure. I'm considering that for DataTables 2 - the downside of course is the additional processing.

    Allan

Sign In or Register to comment.