最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - DataTables API, fnUpdate not taking value from variable - Stack Overflow

programmeradmin1浏览0评论

The following is code snippet to update two cells of a single row using fnUpdate function: (ref:Datatables)

var oTable = $('#depGridView').dataTable();
oTable.fnUpdate( 'First', 4, 1 );
oTable.fnUpdate( 'Last', 4, 2 );

The above code successfully update second and third column of fifth row (:index=4). To get the index value run time , I made the following changes

var oTable = $('#depGridView').dataTable();
var getIndex = document.getElementById("indexDepRow").value;
oTable.fnUpdate( 'First', getIndex , 1 );
oTable.fnUpdate( 'Last', getIndex , 2 );

but this does not working, it not update my row. To check that the variable getIndex storing correct index value, I use alert(getIndex) in script. It alert me 4 when I click on fifth row.

How can we overe this?

The following is code snippet to update two cells of a single row using fnUpdate function: (ref:Datatables)

var oTable = $('#depGridView').dataTable();
oTable.fnUpdate( 'First', 4, 1 );
oTable.fnUpdate( 'Last', 4, 2 );

The above code successfully update second and third column of fifth row (:index=4). To get the index value run time , I made the following changes

var oTable = $('#depGridView').dataTable();
var getIndex = document.getElementById("indexDepRow").value;
oTable.fnUpdate( 'First', getIndex , 1 );
oTable.fnUpdate( 'Last', getIndex , 2 );

but this does not working, it not update my row. To check that the variable getIndex storing correct index value, I use alert(getIndex) in script. It alert me 4 when I click on fifth row.

How can we overe this?

Share Improve this question edited Oct 3, 2013 at 4:20 madth3 7,34412 gold badges52 silver badges74 bronze badges asked May 13, 2012 at 18:40 Both FMBoth FM 7701 gold badge14 silver badges33 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 4

use parseInt(getIndex) instead of using row directly.

DEMO

Hope this helps

发布评论

评论列表(0)

  1. 暂无评论