This shows you the differences between two versions of the page.
|
plugin:sortablejs [2009/11/06 19:16] 74.93.99.97 |
plugin:sortablejs [2010/01/21 07:43] (current) kououken |
||
|---|---|---|---|
| Line 73: | Line 73: | ||
| * Version 2.2a Fixed some jslint error which caused CSS+JavaScript compress to break. | * Version 2.2a Fixed some jslint error which caused CSS+JavaScript compress to break. | ||
| * Version 2.3 adds support for [[:plugin:odt|odt]] plugin. (Thanks Aurélien Bompard) Unfortunately the sort order in page source is used. It is not possible to output the new sort order. | * Version 2.3 adds support for [[:plugin:odt|odt]] plugin. (Thanks Aurélien Bompard) Unfortunately the sort order in page source is used. It is not possible to output the new sort order. | ||
| - | |||
| ===== Discussion ===== | ===== Discussion ===== | ||
| * When the <sortable> tag is added, **all** tables on the page are made sortable. When two sortable tags are defined, ascending sorting will not occur anymore. Both are caused by an error in the JavaScript: The ''makeSortablediv'' function gets all table elements from the //document// instead of from the //DIV//. | * When the <sortable> tag is added, **all** tables on the page are made sortable. When two sortable tags are defined, ascending sorting will not occur anymore. Both are caused by an error in the JavaScript: The ''makeSortablediv'' function gets all table elements from the //document// instead of from the //DIV//. | ||
| Line 133: | Line 132: | ||
| > I would still call these features... :-) --- //[[otto@valjakko.net|Otto Vainio]] 2009/01/28 15:26// | > I would still call these features... :-) --- //[[otto@valjakko.net|Otto Vainio]] 2009/01/28 15:26// | ||
| + | |||
| + | **Quick and dirty fix for mixed Formats in Columns:** The Problem is, that the plugin will use a numeric sort if there is //only one cell// that has only numers in it. The following code will cause the plugin to only use the numeric sorting if all columns are numeric. Additionally, this code will enable the sorting of dates, which use a point as delimiter instead of a / | ||
| + | <code> | ||
| + | guessType: function(table, column) { | ||
| + | // guess the type of a column based on its first non-blank row | ||
| + | sortfn = sorttable.sort_alpha; | ||
| + | for (var i=0; i<table.tBodies[0].rows.length; i++) { | ||
| + | text = sorttable.getInnerText(table.tBodies[0].rows[i].cells[column]); | ||
| + | if (text !== '') { | ||
| + | // check for a date: dd/mm/yyyy or dd/mm/yy | ||
| + | // can have / or . or - as separator | ||
| + | // can be mm/dd as well | ||
| + | possdate = text.match(sorttable.DATE_RE); | ||
| + | if (possdate) { | ||
| + | // looks like a date | ||
| + | first = parseInt(possdate[1]); | ||
| + | second = parseInt(possdate[2]); | ||
| + | if (first > 12) { | ||
| + | // definitely dd/mm | ||
| + | return sorttable.sort_ddmm; | ||
| + | } else if (second > 12) { | ||
| + | return sorttable.sort_mmdd; | ||
| + | } else { | ||
| + | // looks like a date, but we can't tell which, so assume | ||
| + | // that it's dd/mm (English imperialism!) and keep looking | ||
| + | sortfn = sorttable.sort_ddmm; | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | if ( sortfn == sorttable.sort_alpha ) | ||
| + | { | ||
| + | for (var i=0; i<table.tBodies[0].rows.length; i++) { | ||
| + | text = sorttable.getInnerText(table.tBodies[0].rows[i].cells[column]); | ||
| + | if (text !== '') { | ||
| + | if (text.match(/^-?[£$€]?[\d,.]+%?$/)) { | ||
| + | sortfn = sorttable.sort_numeric; | ||
| + | } | ||
| + | else | ||
| + | return sorttable.sort_alpha | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | return sortfn; | ||
| + | }, | ||
| + | </code> | ||
| ---- | ---- | ||
| Line 160: | Line 205: | ||
| >For me "csv" and "sortable" work fine together - it needs some time before the effect is shown. "Sortable" works with "csv" hold in "Media-Collection" as well as in page-stored csv. But I considered a different behavior of searchengine: If I store my csv-file in mediacenter, the content isn't searchable! If I store the csv in the page, the search engine finds the content!\\ //utaf 2009/06/11// | >For me "csv" and "sortable" work fine together - it needs some time before the effect is shown. "Sortable" works with "csv" hold in "Media-Collection" as well as in page-stored csv. But I considered a different behavior of searchengine: If I store my csv-file in mediacenter, the content isn't searchable! If I store the csv in the page, the search engine finds the content!\\ //utaf 2009/06/11// | ||
| + | |||
| + | >It also worked for me with the "csv" plugin. Gimili17 2009/11/19. What a great plugin! | ||
| ---- | ---- | ||
| Line 229: | Line 276: | ||
| >> Thank you for checking! Perhaps this is a fault in my expectations. I cleared my local cache, and touch'ed conf/local.php, and sortable doesn't seem to respect the initial sort parameter (e.g., <sortable r1>). Did I misunderstand how to use this parameter? Also, I'd expected that the arrow would show up upon refresh (or the first visit to a page) to indicate this initial sorting, and to cue the user that the column headers may be clicked on to sort the table, but it isn't there. It took me a while to realize, without the arrow, that I could click on the headers to sort them. But you're right, it does actually work. --- //[[michael@repucci.org|Michael Repucci]] 2009/11/05 14:05// | >> Thank you for checking! Perhaps this is a fault in my expectations. I cleared my local cache, and touch'ed conf/local.php, and sortable doesn't seem to respect the initial sort parameter (e.g., <sortable r1>). Did I misunderstand how to use this parameter? Also, I'd expected that the arrow would show up upon refresh (or the first visit to a page) to indicate this initial sorting, and to cue the user that the column headers may be clicked on to sort the table, but it isn't there. It took me a while to realize, without the arrow, that I could click on the headers to sort them. But you're right, it does actually work. --- //[[michael@repucci.org|Michael Repucci]] 2009/11/05 14:05// | ||
| + | |||
| + | ---- | ||
| + | I see a problem when clicking on a non-existing link in the table, then creating the page: the (now existing) link is not displayed as such... probably a problem of meta-data not being built. | ||
| + | |||
| + | Removing the "sortable" tag and updating the page fixes it... but I don't want to do it each time I create a page. You may want to try by changing the name of the links below to some non existing page in the playground... --- //[[berteh@hotmail.com|berteh]] 2009/11/27// | ||
| + | <code> | ||
| + | <sortable> | ||
| + | ^ T1 ^ T2 ^ | ||
| + | | [[playground:non existing page1]] | [[playground:non existing page 2]] | | ||
| + | </sortable> | ||
| + | </code> | ||
| + | |||
| + | ---- | ||
| + | |||
| + | I believe I may have found a bug in the way sortablejs changes how footnotes work. Normally, the notes within a sortable table are collected and shown at the bottom of the sortable table, and all other notes are shown at the bottom of the page. While the notes are appearing correctly at both places, the pop-up text and links in-document repeat the info from the sortable table footnotes. | ||
| + | |||
| + | This is sort of hard to explain, so I'll just show some sample code and you can take a look. | ||
| + | |||
| + | <sortable> | ||
| + | ^ Sortable Table ^ | ||
| + | | contents((footer for the sortable table)) | | ||
| + | </sortable> | ||
| + | |||
| + | Normal Text((footer for the normal text)) | ||
| + | |||
| + | For me, both hovers will show the "footer for the sortable table" text, because they both have the #fnt__1 id I think. Can anyone confirm this? --- //kououken 2010/01/21 07:41// | ||