tablesorter ajax,jquery - Tablesorter ajax sorting - Stack Overflow

I need to sort a table with 3 columns which have 3 differents dates. The table is built in ajax. In every load, ajax load the table and dates are unsortable. I've tried to change dateFormat and other but impossible to make this possible. Can you help me ? Here it is :

if($('#listeDevis') && $('#listerDevis') && $('#listerDevis').val() == 'true'){

$.ajax({

url : '/actions/listerDevisEnCours',

dataType : 'html',

beforeSend : function(){

$('#loaderDevis').show();

},

success : function(data){

$('#listeDevis').html(data);

$('#nombreDevis').text($('#nombreDevisList').val());

$('.tachesTables').hide();

$('.bulleAide').hide();

$('.infoComplementaire').hide();

$('#tachesDevisEnCoursTables').show();

$('.tachesTitres').click(function(){

$('.tachesTables').hide();

$('.tachesTitres').children('span').text('+');

$(this).next().show();

$(this).children('span').text('-');

});

$('.voirBulleAide').hover(function(){

var top = $(this).offset().top - $(this).next('.bulleAide').innerHeight() - 4;

$(this).next('.bulleAide').show().css({'top': top + 'px'});

}, function(){

$('.bulleAide').hide();

});

$('.voirInfoComplementaire').hover(function(){

var top = $(this).offset().top - $(this).children('.infoComplementaire').innerHeight() - 4;

$(this).children('.infoComplementaire').show().css({'top': top + 'px'});

}, function(){

$('.infoComplementaire').hide();

});

},

complete : function(){

$('#loaderDevis').hide();

$('#tacheEnCours').addClass('trierTable').tablesorter({

dateFormat: "uk",

headers: {

2: "shortDate",

7: "shortDate",

8: "shortDate"

}

});

$('#tacheEnCours').trigger('update');

},

error : function(jqXHR,textStatus, errorThrown){

console.log(jqXHR);console.log(textStatus);console.log(errorThrown);

// alert("Erreur lors de la connexion au serveur");

}

});

}

Thanks for your help !

Edit : Sorry @Mottie i am late, I have been assigned to another project and then I didn't fix this bug. Sorry again, let me show you the html. This table is generated in ajax and the format is dd/mm/yyyy. I already tried to set the format on uk but it didn't work...

NºDateClientStatutCommentaireDate StatutDate Échéance

UPDATE :

I've tried your code but it still doesn't work... I don't understand why other columns work but just date columns doesn't work... I have set a right dateFormat with sorter: "shortDate".

$.ajax({

url : '/actions/listerDevisEnCours',

dataType : 'html',

beforeSend : function(){

$('#loaderDevis').show();

},

success : function(data){

$('#listeDevis').html(data);

$('#nombreDevis').text($('#nombreDevisList').val());

$('.tachesTables').hide();

$('.bulleAide').hide();

$('.infoComplementaire').hide();

$('#tachesDevisEnCoursTables').show();

$('.tachesTitres').click(function(){

$('.tachesTables').hide();

$('.tachesTitres').children('span').text('+');

$(this).next().show();

$(this).children('span').text('-');

});

$('.voirBulleAide').hover(function(){

var top = $(this).offset().top - $(this).next('.bulleAide').innerHeight() - 4;

$(this).next('.bulleAide').show().css({'top': top + 'px'});

}, function(){

$('.bulleAide').hide();

});

$('.voirInfoComplementaire').hover(function(){

var top = $(this).offset().top - $(this).children('.infoComplementaire').innerHeight() - 4;

$(this).children('.infoComplementaire').show().css({'top': top + 'px'});

}, function(){

$('.infoComplementaire').hide();

});

},

complete : function(){

$('#loaderDevis').hide();

$('#tacheEnCours').tablesorter({

dateFormat: 'uk',

headers: {

1: {sorter: "shortDate"},

5: {sorter: "shortDate"},

6: {sorter: "shortDate"}

}

});

},

error : function(jqXHR,textStatus, errorThrown){

console.log(jqXHR);console.log(textStatus);console.log(errorThrown);

// alert("Erreur lors de la connexion au serveur");

}

});

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值