从Angular Datatable中的jQuery ColumnFIlterWidget插件隐藏/删除额外的下拉窗口小部件

时间:2016-12-22 21:06:21

标签: javascript jquery angularjs datatables angular-datatables

基本上我想在这里做两件事。我在这里使用columnFilterWidget.js jQuery DataTable插件进行列过滤。我在“排除”一个额外下拉列表中遇到了一些问题,这是第6个<td>并且它具有完整的dataTable内容HTML。目前排除第6列正在取消所有数据并显示空数据

这是我的HTML:

<table datatable="ng" dt-options="dtOptions"
    dt-instance="dtInstanceCallback" style="width: 100%" id="quoteMgmt">

    <thead>
        <tr>
            <th>Customer</th>
            <th>Origin City</th>
            <th>Origin State</th>
            <th>Destination City</th>
            <th>Destination State</th>
            <th></th> 

       </tr>
    </thead>
    <tbody>

        <tr ng-repeat="quote in mgmtQuote track by quote.quoteNumber">

            <td style="display: none">
                {{ quote.customerInfoVo.customerName }}</td>
            <td style="display: none">
                {{ quote.eqmCommonInfo.origCity }}</td>
            <td style="display: none">
                {{ quote.eqmCommonInfo.origState }}</td>
            <td style="display: none">
                {{ quote.eqmCommonInfo.destCity }}</td>
            <td style="display: none">
                {{ quote.eqmCommonInfo.destState }}</td>    

            <td>
                <div class="row">
                    <div class="seven columns">
                    [Datatable Content]

这是我的app.js

 $scope.dtOptions = DTOptionsBuilder.newOptions()
                .withOption('sDom', 'ltip')
                .withOption('iDisplayLength', 25)
                .withOption('fnDrawCallback',function(oSettings){$(oSettings.nTHead).hide();SpinnerService.hide();})
                .withOption('aaSorting',[])
                .withLanguage({"sEmptyTable":"No quotes available"})
                .withOption("sDom", 'W<"clear">lfrtip')
                .withOption('aoColumnDefs',[{
                    'bVisible':true,'aTargets':[0,1,2,3,4]
                }])
                .withOption('aoColumnDefs',[{
                    'bVisible':false,'aTargets':[5]
                }]);

1 个答案:

答案 0 :(得分:0)

我可以通过不同的语法来修复它。在使用Angular Datatable DTOptionsBuilder时,应该小心使用语法。发布我的答案,万一它可以帮助某人。

   $scope.dtOptions = DTOptionsBuilder.newOptions()
                .withOption('iDisplayLength', 25)
                .withOption('fnDrawCallback',function(oSettings){$(oSettings.nTHead).hide();SpinnerService.hide();})
                .withOption('aaSorting',[])
                .withOption('bJQueryUI',false)
                .withOption('bDeferRender',true)
                .withLanguage({"sEmptyTable":"No quotes available"})
                .withOption("sPaginationType",'full_numbers')
                .withOption('sDom', 'W<"clear">lrtip')
                .withOption("aoColumns",[
                   /*0 Customer */         {"bVisible":false},
                   /*1 Origin City */      {"bVisible":false},
                   /*2 Origin State */     {"bVisible":false},
                   /*3 Desination City */  {"bVisible":false},
                   /*4 Desination State */ {"bVisible":false},
                   /*5 Equipment Type */   {"bVisible":false},
                   /*6 Entire Datatable */ {"bVisible":true},
                   /*7 Sent Date */        {"bVisible":false},
                   /*8 Expiration Date */  {"bVisible":false},
                   /*9 Awarded Date */     {"bVisible":false},
                   /*10 Awarded Date desc*/{"bVisible":false}
                 ])
                 .withOption("oColumnFilterWidgets",{
                      "aiExclude":[6,7,8,9,10],
                      "sSeparator": "\\s*/+\\s*",
                      "bGroupTerms": false,
                 })