4

JS:

$(document).ready(function() {
//  $( "#dashboard_container" ).tabs();
    $('#listings').dataTable({
                                "bRetrieve": true,
                                "aoColumns":
                                [
                                    { "bVisible": false },
                                    { "bVisible": false },
                                    { "bVisible": false },
                                    { "bVisible": false },
                                    { "bVisible": false },
                                    { "bVisible": false },
                                    { "bVisible": false },
                                    { "bVisible": false },
                                    { "bVisible": false },
                                ]
    }).rowGrouping({
            iGroupingColumnIndex: 1,
            sGroupingColumnSortDirection: "asc",
            iGroupingOrderByColumnIndex: 0,
            bExpandableGrouping: true, 
            bExpandSingleGroup: true,
            iExpandGroupOffset: -1
    });
});

HTML:

    <table class="datatable" id="listings">
    <thead>
        <tr>
            <th>Group Index</th><th>Group Display Name</th>
            <th>Organization</th>
            <th>Volumes</th>
            <th>Read (MB/s)</th>
            <th>Write (MB/s)</th>
            <th>Volume Size (GB)</th>
            <th>My Cost (USD)</th>
            <th>Comments</th>
        </tr>
    </thead>
    <tfoot></tfoot>
    <tbody>
        <tr>
            <td>0</td><td><a href="/dashboard/" class="orglist_group_link">Artful Scientific</a></td>
            <td>Something Co.</td>
            <td><a href="/details/view?volume=12345678" class="orglist_link">information</a></td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>$0</td>
            <td><a class="btn small icon i_preview comment_edit_button" rel="1" title="edit or view comment">View</a></td>
        </tr>
           </tbody>
        </table>
     </div>

問題:

行のグループ化を正常に行うことができ、正常に動作しますが、特定の役割に対して 2 つの列を非表示にする必要があります。グループ化が使用する「組織」列に相当する追加の列を非表示にするだけでなく。ただし、上記の JS から、ここに来る前に最後の溝の努力で実際に非表示になるかどうかを確認するために、すべての列を非表示にしようとしたことがわかります。どれが全部隠れるか、どれが隠れるかは関係ありません。誰でもこれの回避策を知っていますか? 列をそのままにしておく必要があるため、実際のビューには表示されません

4

1 に答える 1

4

このコマンドを使用して列を非表示にします。最初のパラメーターは列のインデックスで、2番目のパラメーターは表示されます。

fnSetColumnVis(1、false);

于 2012-11-09T12:21:54.373 に答える