Auntion-tablesort written by a JavaScript table sort of things _javascript tips
Source: Internet
Author: User
Auntion-tablesort The latest edition fixes a problem with a numeric sort. release Download May 5, 07
Auntion tablesort Test Exchange First Edition
(some form-related effects will be present in the next edition)
-----------------------------------------------------------------------------
Note:
Reproduced please send this note all out, because the novice may not be used, and the description will have a more detailed extension of the description.
For domestic JavaScript level of common progress, let us work together!
This edition is 3 days complete, there may be upgrades in the future, please pay attention to my blog.
Compatible with IE, Firefox core. The other I have not tested, I only installed these two browsers
Support visual editing, as usual to do table, use only set an ID can be used
Sort:
Number: According to the size can be descending ascending order
Letters: Same number
Date: Same number, don't include Chinese in format
Radio, check boxes: by True or false
In Chinese: the same arrangement as the first word.
Provides a user interface definition. You can implement different trigger sorting methods yourself
Encapsulation, inheritance, polymorphism.
Inheritance please use prototype
Sets the header, which is a class name for the TD that triggers the column
Create the object, that is, initialize Tablesort this class.
Use the default sort triggering method
If initialized?
var apply = new Tablesort ("Bodys", "tag");
Apply.totagstart ();//This will use a default triggering method that has already been defined.
where "Bodys" is the ID of the table (can be object or string)--depending on your form ID
WHERE "tag" for each column head TD's Class name
> For friends who are interested in expanding:
This class will provide an extensible pattern that is currently limited to the triggering method, the user interface.
Please refer to TableSort.class.js for details
Note:
You can trigger the sort-step in different ways:
1. Creating objects
2. (This part can be selected according to the situation) polymorphic way to set the Tempcellindex property to the subscript of the column you want to sort
If I want to sort the third row, the Tempcellindex property is 3
3. Get and set status (see Comments in TableSort.class.js)
4. Change the CSS style of the column header
5. Initialize Start sort
(the first and second parts are not included in the user interface, for actions when creating objects)
(The second part is set after the object is created)
I'm not very good at expressing myself, if I don't understand, please see tableSort.class.js.
/** by clicking on the tag to trigger the sort event **/this part
Package download
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.