Handsontable Sorting problems

Source: Internet
Author: User

Sorting is the basic function of the table, and handsontable will support it.

Sometimes the requirements can be complex, require custom sorting, or call other sorting methods; custom sorting is complicated, not done; today's call to the sorting method in R.

There are two events beforecolumnsort and aftercolumnsort; Useful is the former, index,order parameter, but not supported: return false; Disables the default sorting method.

In the source code, there are several important places:

DEFAULTSORT: The default sorting method, because data and strings are mixed together in the table, want to only sort data, if typeof a[1] = = ' String ' to a[1] = infinity or return-1; The result is not ideal. It supports sorting algorithms that have problems, only 22 comparisons, and if they have the same number, they will be compared to the latter, and the sorting result will be wrong.

This.defaultsort: The next sentence is to call the sort method. If it is commented out, it will not be executed, but the icon will change.

Beforecolumnsort: Sort of event flow, can be seen clearly, the effect of each stage

Beforecolumnsort event: By setting Hot.sortorder = false; The first sort, is still small to large. There will be errors later.

Purpose: String does not participate in sorting

1, the modification defaultsort did not succeed;

2, comment out the execution of the order of the statement, sorted by R, and then refresh the data, the indicator will flash through, because the table will refresh.

Handsontable Sorting problems

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.