Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions coffee/sortable.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,19 @@ sortable =
rowArray.push [value, row, position]

rowArray.sort compare
tBody.appendChild row[1] for row in rowArray
# use document fragment for performance
# when sorting large tables (avoid recalculating styles)
fragment = document.createDocumentFragment()
fragment.appendChild row[1] for row in rowArray
tBody.appendChild fragment
else
rowArray.push item for item in tBody.rows
rowArray.reverse()
tBody.appendChild row for row in rowArray
# use document fragment for performance
# when sorting large tables (avoid recalculating styles)
fragment = document.createDocumentFragment()
fragment.appendChild row for row in rowArray
tBody.appendChild fragment

if typeof window['CustomEvent'] is 'function'
table.dispatchEvent?(new CustomEvent 'Sortable.sorted', { bubbles: true })
Expand Down
23 changes: 15 additions & 8 deletions js/sortable.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/sortable.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"author": "Adam Schwartz <adam.flynn.schwartz@gmail.com>",
"license": "MIT",
"devDependencies": {
"grunt-contrib-coffee": "~0.7.0",
"coffee-script": "~1.6.3",
"grunt-contrib-uglify": "~0.2.4",
"grunt": "^0.4.5",
"grunt-cli": "~0.1.9",
"grunt": "~0.4.1",
"grunt-contrib-watch": "~0.5.3",
"grunt-contrib-compass": "~0.5.0"
"grunt-contrib-coffee": "^0.7.0",
"grunt-contrib-compass": "^0.5.0",
"grunt-contrib-uglify": "^0.2.7",
"grunt-contrib-watch": "^0.5.3"
}
}
}