适用于Ajax表的DataTables jQuery插件nowrap [英] DataTables jQuery plugin nowrap for Ajax table

查看:97
本文介绍了适用于Ajax表的DataTables jQuery插件nowrap的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人能给我一个示例,说明如何为ajax表动态生成所有信息时如何向列中添加nowrap ="nowrap"?

Can someone give me an example of how to add a nowrap="nowrap" to a column when all information is generated on the fly for an ajax table?

$('#results').dataTable({
    "fnRowCallback": function( nRow, aData, iDisplayIndex ) {
        $(nRow).attr('id', aData[0]);
        return nRow;
    },
    "bAutoWidth": false,
    "sPaginationType": "full_numbers",  
    "bProcessing": true,
    "sAjaxSource": 'ajax/purchasers.php',
    "aaSorting": [[1,'asc']],                   
    "aoColumns": [                              
        { "bVisible": false },                      
        null,                                   
        null,
        null,
        null,
        null,
        null,
        null
    ]
});

我知道这可能很远.预先感谢.

I know this might be a long shot. Thanks in advance.

推荐答案

如果有人对解决方案感兴趣,可以在数据表完成呈现后使用fnInitComplete遍历表,如下所示:

In case anyone is interested in the solution, you can use fnInitComplete to loop over the table after DataTables is done rendering it like so:

$('#results').dataTable({
    "fnInitComplete": function() {
        $('#results tbody tr').each(function(){
                $(this).find('td:eq(0)').attr('nowrap', 'nowrap');
        });
    },
    "sAjaxSource": 'ajax/purchasers.php'
});

这篇关于适用于Ajax表的DataTables jQuery插件nowrap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆