douquqiang1513 2015-03-31 09:43
浏览 48

数据表显示/隐藏复选框无法正常工作

I am using DataTable to display the data. All the column names with check box is displaying when i click show and hide button. When i uncheck all the column and when i try to check the column name at that time the first column is getting copied or getting displayed in the all the row values.

Following is my code which i written.

$('#datatable_col_reorder').dataTable({
        "processing": true,
        "sAjaxSource": "<?php echo $config['ajaxUrlPath'];>json.php",
        "bFilter" : true,
        "fnServerData": function ( sAjaxSource  , aoData, fnCallback ) {
            aoData.push( { "name": "eventName", "value": $('#eventName').val()   });
            aoData.push( { "name": "et", "value": $('#Type').val() });
            aoData.push( { "name": "vn", "value": $('#address').val() });
            aoData.push( { "name": "da", "value": $('#date_added').val() });
            aoData.push( { "name": "ti", "value": $('#time_added').val() });
            aoData.push( { "name": "st", "value": $('#status').val() });
            aoData.push( { "name": "br", "value": $('#status1').val() });
            aoData.push( { "name": "cr", "value": $('#status2').val() });
            aoData.push( { "name": "pr", "value": $('#spercentage').val() });
            // etc
            $( "#status2,#address,#spercentage" ).keyup(function() {
                var table = $('#datatable_col_reorder').DataTable();
              table.ajax.reload();
            });
            $( "#status,#Type,#date_added,#time_added,#status1,#status2" ).change(function() {
                var table = $('#datatable_col_reorder').DataTable();
              table.ajax.reload();
            });

            $.getJSON( sAjaxSource, aoData, function (json) { console.log(json); fnCallback(json) } );
        },                            
        "sDom":"<'col-sm-1 col-xs-1 col-md-1 col-lg-1 showHidebutton'C><'dt-toolbar'r>"+
                "t"+
                "<'dt-toolbar-footer'<'col-sm-6 col-xs-12 hidden-xs'i><'col-sm-6 col-xs-12'p>>",
        "autoWidth" : true,
        "rowCallback": function( nRow, aData, iDisplayIndex ) {
                           // responsiveHelper_datatable_tabletools.createExpandIcon(nRow);
                            $('td:eq(0)', nRow).html('<a href="<?php echo str_replace('/ajax/','/#ajax/',$config['ajaxUrlPath']);?>edit.php?id='+ aData[8] + '">'+aData[0]+'</a>');
                            return nRow;
                       },
        "preDrawCallback" : function() {
            // Initialize the responsive datatables helper once.
            if (!responsiveHelper_datatable_col_reorder) {
                responsiveHelper_datatable_col_reorder = new ResponsiveDatatablesHelper($('#datatable_col_reorder'), breakpointDefinition);
            }
        },

        "drawCallback" : function(oSettings) {
            responsiveHelper_datatable_col_reorder.respond();
        }           
    });

Show/Hide Columns

When i uncheck all and when i try to recheck each checkboxes, at that time the first column values are getting displayed in all other column like type,status,address etc. Example: Consider Name: XYZ, After deselecting checkboxes if i try to recheck at that time the each column values is showing "XYZ" in status,address columns.

Thanks in advance.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
    • ¥20 怎么用dlib库的算法识别小麦病虫害
    • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
    • ¥15 java写代码遇到问题,求帮助
    • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
    • ¥15 有了解d3和topogram.js库的吗?有偿请教
    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
    • ¥15 关于#Java#的问题,如何解决?