jQuery UI Widgets Forums DataTable Datatable issue with the sort when value is "undefined"

This topic contains 1 reply, has 2 voices, and was last updated by  Dimitar 9 years, 8 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author

  • rattek
    Participant

    Hi,

    We are using a Datatable widget bound on a DataAdapter and the data are updated using a Rest service returning a list of heterogeneous JSON objects.

    We are experiencing problems when sorting a numeric column in the Datatable. The problem is that the compare function doesn’t handle the case when a value is “undefined”. When it compares a numeric value (such as 1.23) and an other that is “undefined”, it always return 0 (or equal – which is not the case).

    After some tries, we have discovered that this same sorting functionality work as it’s supposed to when all the empty values are “null” (instead of undefined). However, our architecture doesn’t allows us to change/set all the undefined value to null…

    So, is there a way to update this widget to care of undefined values?

    Thank you in advance for your time!


    Dimitar
    Participant

    Hi rattek,

    A possible solution is to change all the undefined values received from the server to null values in the data adapter’s beforeLoadComplete callback function. You can find examples of its use in the jqxDataAdapter help topic.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.