【问题标题】:Datatable 1.9.4 edit row with fnUpdate without redrawDatatable 1.9.4 使用 fnUpdate 编辑行而不重绘
【发布时间】:2016-02-12 12:24:37
【问题描述】:

我想在不重绘的情况下编辑一行...我使用https://legacy.datatables.net/ref#fnUpdate,并且该功能是这样工作的;

oTable.fnUpdate( 1, 2, 3, 4, 5); 
  1. {object|array|string}:用
  2. 更新单元格/行的数据
  3. {node|int}:要更新的 TR 元素或 aoData 索引
  4. {int}:要更新的列(设置为未定义以更新整行)
  5. {bool} [default=true]:是否重绘表格
  6. {bool} [default=true]:是否执行预绘制操作

例子:

oTable.fnUpdate( 'Example update', 0, 0); // Update Single cell (0,0) and redraw
oTable.fnUpdate( 'Example update', 0, 0, false); // Update Single cell (0,0) and NOT redraw
oTable.fnUpdate( ['a', 'b', 'c', 'd', 'e'], 1 );    // Update Row 1 and redraw

如果我想更新而不重绘???

oTable.fnUpdate( ['a', 'b', 'c', 'd', 'e'], 1, ???, false );    // Update Row 1 and NOT redraw

谢谢

【问题讨论】:

    标签: datatable


    【解决方案1】:

    我找到了……

    oTable.fnUpdate( ['a', 'b', 'c', 'd', 'e'], 1, undefined, false );
    

    【讨论】:

      【解决方案2】:

      var rowIndex = $('#example').dataTable().fnGetPosition(element.closest("tr").get(0)); $('#example').dataTable().fnUpdate('Approved', rowIndex , 7,false);

      【讨论】:

        【解决方案3】:
        $('#example').dataTable().fnUpdate( 'Approved', 2, 5,false);//for 3rd row 6 column
         $('#example').dataTable().fnUpdate( 'rejected', 2, 6,false);//for 3rd row 7 column
        

         $('#example').dataTable().fnUpdate( ['Approved',rejected'',...], 2, [0,1,...],false);//for 3rd row all columns
        

        【讨论】:

        • 您能否在答案中包含更多解释?
        【解决方案4】:

        在不重绘表格和不影响列宽的情况下更新单元格内容

        $('#...').dataTable().fnUpdate(
           'cell data', 
           <row #>,   
           <column #>,
           false,     // redraw as false
           false      // making predraw actions also false
        );
        

        为我工作

        【讨论】:

          猜你喜欢
          • 2015-01-02
          • 2014-04-12
          • 2018-10-02
          • 1970-01-01
          • 2019-10-28
          • 1970-01-01
          • 1970-01-01
          • 2013-10-21
          • 1970-01-01
          相关资源
          最近更新 更多