Hi,
may be monday morning
but I don’t understand why on earth this
snippet works only the first time
$container.on('click','th.sortable i',function(e){
e.preventDefault();
var $this = $(this);
var path = $('.pagination li.active').attr('data-url');
var removeCls = $this.attr('class');
$this.removeClass(removeCls);
var $th = $this.closest('th');
var orderby = $th.attr('data-orderby');
if(removeCls==='icon-circle-arrow-down'){
orderby++
$this.addClass('icon-circle-arrow-up');
}
else{
$this.addClass('icon-circle-arrow-down');
orderby--;
}
$th.attr('data-orderby',orderby);
console.log(path);
var newPath = path.replace(/orderby\\/[0,9]/,'orderby\\/'+orderby);
console.log(newPath);
console.log(orderby);
});
when I click the first time if I’ve got
in path
/en/admin/users/index/page/1/orderby/0/np/3
and in orderby 7
I got
/en/admin/users/index/page/1/orderby/7/np/3
the second time
/en/admin/users/index/page/1/orderby/7/np/3
/en/admin/users/index/page/1/orderby/7/np/3
and ibn orderby 6