This repository has been archived by the owner on Aug 8, 2019. It is now read-only.
forked from mootools/mootools-more
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes bug described in mootools#1346
Sources out the creation of the sort-span tag in order to re-inject them on re-enable sorting.
- Loading branch information
Henning Bopp
committed
Feb 5, 2017
1 parent
f872370
commit 390175b
Showing
1 changed file
with
13 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ authors: | |
- Harald Kirschner | ||
- Aaron Newton | ||
- Jacob Thornton | ||
- Henning Bopp <[email protected]> | ||
requires: | ||
- Core/Hash | ||
|
@@ -95,8 +96,7 @@ HtmlTable = Class.refactor(HtmlTable, { | |
if (cell.hasClass(this.options.classNoSort) || cell.retrieve('htmltable-parser')) return cell.retrieve('htmltable-parser'); | ||
var thDiv = new Element('div'); | ||
thDiv.adopt(cell.childNodes).inject(cell); | ||
var sortSpan = new Element('span', {'class': this.options.classSortSpan}).inject(thDiv, 'top'); | ||
this.sortSpans.push(sortSpan); | ||
this.getHeadSpan().inject(thDiv, 'top'); | ||
var parser = this.options.parsers[index], | ||
rows = this.body.rows, | ||
cancel; | ||
|
@@ -262,6 +262,7 @@ HtmlTable = Class.refactor(HtmlTable, { | |
this.element.addClass(this.options.classSortable); | ||
this.attachSorts(true); | ||
this.setParsers(); | ||
this.head && this.head.getElements(this.options.thSelector).flatten().map(this.injectHeadSpan, this); | ||
this.sortable = true; | ||
return this; | ||
}, | ||
|
@@ -275,8 +276,17 @@ HtmlTable = Class.refactor(HtmlTable, { | |
this.sortSpans.empty(); | ||
this.sortable = false; | ||
return this; | ||
} | ||
}, | ||
|
||
getHeadSpan: function(parent){ | ||
var sortSpan = new Element('span', {'class': this.options.classSortSpan}); | ||
this.sortSpans.push(sortSpan); | ||
return sortSpan; | ||
}, | ||
|
||
injectHeadSpan: function(parent){ | ||
return this.getHeadSpan().inject(parent); | ||
} | ||
}); | ||
|
||
HtmlTable.ParserPriority = ['date', 'input-checked', 'input-value', 'float', 'number']; | ||
|
@@ -358,4 +368,3 @@ HtmlTable.defineParsers = function(parsers){ | |
}; | ||
|
||
})(); | ||
|