0

データテーブルの並べ替えを使用するときに最後の列を修正する方法は?

私はそれが動作しない以下を試しました:

var oTable = $('#example').dataTable({
                "sDom": 'R',
                "oColReorder": {
                    "iFixedColumns":[-1]    
                }
             }); 
4

1 に答える 1

0

私は以下の解決策を見つけました:以下のようにテーブルの最後にdivを追加しました:

<th >First</th>
<th >2</th>
<th >3</th>
<th >4</th>
<th ><div id="theLast">last</div></th>

次のスクリプトを呼び出しました。

$(document).ready(function () {
            $("#theLast").bind("mousedown", function (event) {
                event.stopPropagation(true);
                return;
            }
            );

            var oTable = $('#example').dataTable({
                "sDom": 'R'
        });

    });

このように、colReorder機能の最後の列を無効にしました。この最後の列の後に他の列が削除されないようにするために、ColReorder.jsファイル内のコードを次のように変更しました。

関数が変更されました:_fnMouseUp

私が書いた :

if (this.s.mouse.toIndex == 4) { // 4 means last  column index 
                    e.stopPropagation(true);
                    return null;
                }
                else
                /* Actually do the reorder */
                this.s.dt.oInstance.fnColReorder(this.s.mouse.fromIndex, this.s.mouse.toIndex);

それ以外の

this.s.dt.oInstance.fnColReorder(this.s.mouse.fromIndex, this.s.mouse.toIndex);
于 2012-09-12T06:01:47.177 に答える