Skip to content

Commit

Permalink
indicate minimal jquery version requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
vegu committed Jul 11, 2022
1 parent a2e6807 commit 12f91ea
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/twentyc.sortable.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/**
* Makes a content listing sortable.
*
* Requirements:
* Requirements:
*
* 1. jquery 1.11.3
* 1. jquery >= 1.11.3
* 2. twentyc.core.js
*/

(function($) {

tc.u.require_namespace("twentyc.listutil");

twentyc.listutil.sortable = {
Expand All @@ -22,7 +22,7 @@ twentyc.listutil.sortable = {
sorter : function(dir) {
return this["_sort_"+dir];
},

_sort_asc : function(a,b) {
if(a > b)
return 1;
Expand All @@ -45,13 +45,13 @@ twentyc.jq.plugin(
"sortable",
{
init : function(opt) {

this.each(function(idx) {

var list = $(this);

list.find("[data-sort-target]").each(function(idx) {

var button = $(this);

button.click(function(e) {
Expand Down Expand Up @@ -84,10 +84,10 @@ twentyc.jq.plugin(
},

sort : function(target, button, sortdir) {

if(sortdir == undefined) {
sortdir = button.data("sort-dir");

if(!sortdir || sortdir == "desc")
sortdir = "asc";
else
Expand All @@ -103,17 +103,17 @@ twentyc.jq.plugin(
var container = list.find(list.data("sort-container")).first()

list.find("[data-sort-target]").removeClass("sort-desc").removeClass("sort-asc");

var rows = container.find(list.data("sort-row"));

rows.sort(function(a,b) {
var av = $(a).find(target).first().data("sort-value");
var bv = $(b).find(target).first().data("sort-value");
return sorter(av, bv);
});

rows.detach().appendTo(container);


});

Expand Down

0 comments on commit 12f91ea

Please sign in to comment.