Why kendo Ui -grid date is not sorting properly?

后端 未结 2 689
执念已碎
执念已碎 2021-01-25 13:26

value is ReinsDepositAmount

**

output

**

I have recently stocked with one of the application date sorting in

相关标签:
2条回答
  • 2021-01-25 13:54

    Based on the provided information, it is unclear if sorting is performed on the client, or on the server.

    If sorting is done on the client by the Kendo UI DataSource, then the date values should be provided in the correct format, so that they are parsed to JavaScript Date objects by Kendo UI. There are multiple different formats that can be parsed, but dd-MM-yyyy is not one of them.

    Here is an example, which demonstrates the above. You will notice the empty row, where the date has not been parsed.

    http://dojo.telerik.com/UcEXO/2

    Generally, it is recommended to serialize dates using commonly accepted standards:

    https://stackoverflow.com/a/15952652/3086237

    If sorting is performed on the server, then Kendo UI is unrelated to the problem and you should debug the server-side implementation.

    0 讨论(0)
  • 2021-01-25 14:00

    You can try parsing the date from response.

    http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-schema.parse

    schema: {
        parse: function(response) {
          for (var i = 0; i < response.length; i++) {
            response[i].ReinsDepositDate = kendo.parseDate(response[i].ReinsDepositDate, "dd/MM/yyyy");
          }
          return response;
        }
      }
    

    Hope this helps.

    0 讨论(0)
提交回复
热议问题