The latest version of Auntion-TableSort has fixed a numerical sorting problem. Released for download on May 5, 2007
The first version of Auntion TableSort test exchange
(the next version will have some table-related special effects)
------------------------------------------------ -----------------------------
Author:Auntion
blog:Auntion.blogbus.com
e-mail:Auntion@Gmail.com
QQ:82874972
-------------------------- --------------------------------------------------
Note:
Please send out all of this description when reprinting, because there may be novices who cannot use it, and this description will have more detailed expansion instructions.
For the common progress of domestic javascript level, let Let's work together!
This version is completed in 3 days, there may be upgrades in the future, please pay attention to my blog.
--------------------- -------------------------------------------------- -----
The main functions are as follows:
Compatible with IE and Firefox core. I have not tested the others. I only installed these two browsers
Supported Visually edit, make a table as before, just set an id to use.
Sort:
Numbers: Sort in descending and ascending order according to size
Letters: Same as numbers
Date: The same number, do not include Chinese in the format
Radio selection, check box: arranged according to true or false
Chinese: arranged according to the same first character.
Provide user interface definition. You can do it yourself Implement different trigger sorting methods
Encapsulation, inheritance, polymorphism.
Please use prototype for inheritance
---------------- -------------------------------------------------- ----------
> For novices:
How to use?
Please see Usage Example_1.htm:
■ Create a table
■ If you need to beautify it, please set its css style
■ Set the table header, that is, give the td that triggers the column sorting a class name
■ Create Object, that is, initialize the tableSort class.
■ Use the default sorting trigger method
If initialized?
var apply = new tableSort("bodys","tag" );
apply.toTagStart(); //A default trigger method that has been defined will be used here.
■ Where "bodys" is the id of the table (can be object or string) -- According Change your table ID
■ Where "tag" is the class name of each column header td
> For friends who are interested in extending:
This class An extensible mode will be provided, which is currently limited to the triggering method, that is, the user interface.
Please refer to tableSort.class.js for details
Note:
can be triggered in different ways Sorting-steps:
1. Create an object
2. (This step can be selected according to the situation) Polymorphically set the tempCellIndex attribute to the subscript of the column to be sorted
For example, if I want to give the third row For sorting, the tempCellIndex attribute is 3
3. Get and set the status (see the comments in tableSort.class.js)
4. Change the css style of the column header
5. Initialize and start sorting
(The first and second parts are not included in the user interface, they are operations when creating an object)
(The second part is for settings after creating an object)
I My expression ability is not very good. If you don’t understand, please read the
/**Trigger sort event by clicking on label**/ part of tableSort.class.js
Package and download