在ajax中使用tablesorter寻呼机时更改列数

在ajax中使用tablesorter寻呼机时更改列数,ajax,tablesorter,Ajax,Tablesorter,我试图根据ajaxProcessing函数中从服务器返回的内容来添加/删除列。我可以从寻呼机源代码中看出,这不可能直接实现 // only add new header text if the length matches if ( th && th.length === hl ) { 是否有任何解决方法,或者我应该开始修补代码?如果我需要改变,有什么建议吗?谢谢。在ajaxProcessing事件中添加了这一点,

我试图根据ajaxProcessing函数中从服务器返回的内容来添加/删除列。我可以从寻呼机源代码中看出,这不可能直接实现

                // only add new header text if the length matches
                if ( th && th.length === hl ) {

是否有任何解决方法,或者我应该开始修补代码?如果我需要改变,有什么建议吗?谢谢。

在ajaxProcessing事件中添加了这一点,成功了

    var headerCount = $('#id thead tr:eq(0) th').length;
    var hl = data.headers.length;
    if (headerCount < hl) {
        for (var i = headerCount; i < hl; i++) {
            $('#id thead tr:eq(0)').append('<th>' + data.headers[i] + '</th>');
        }
    }else if (headerCount > hl) {
        for (var i = headerCount - 1; i >= hl; i--) {
            $('#id thead tr:eq(0) th:eq(' + i + ')').remove();
        }
    }
    if(headerCount !== hl) $('#id').trigger('updateAll', [false, null]);
var headerCount=$('id thead tr:eq(0)th')。长度;
var hl=data.headers.length;
if(表头计数hl){
对于(var i=表头计数-1;i>=hl;i--){
$('#id thead tr:eq(0)th:eq('+i+')).remove();
}
}
if(headerCount!==hl)$('#id').trigger('updateAll',[false,null]);

您可以在中添加该代码;但是您不需要触发“updateAll”。