我有一个数据表,分页为15行(一页10行,剩下的是第二页)。前10行脚本正在运行。但是当我点击按钮2时,脚本无效。
这是我根据类名编辑行单元格的代码:
$('.consignment').editable( function( sValue ) {
var aPos = oTable.fnGetPosition( this );
var aData = oTable.fnGetData( aPos[0] );
aData[ aPos[1] ] = sValue;
consignmentid1 = sValue;
//alert("consignmentid1"+consignmentid1);
//alert("hi");
return sValue;
}, { "onblur": 'submit' } );
oTable = $('#example').dataTable();
$('.actualprice').editable( function( sValue1 ) {
var aPos = oTable.fnGetPosition( this );
var aData = oTable.fnGetData( aPos[0] );
aData[ aPos[1] ] = sValue1;
actualprice = sValue1;
//alert("actualprice"+actualprice);
return sValue1;
}, { "onblur": 'submit' } );
oTable = $('#example').dataTable();
$('.actualweight').editable( function( sValue2 ) {
var aPos = oTable.fnGetPosition( this );
var aData = oTable.fnGetData( aPos[0] );
aData[ aPos[1] ] = sValue2;
actualweight = sValue2;
//alert("actualweight"+actualweight);
return sValue2;
}, { "onblur": 'submit' } );
oTable = $('#example').dataTable();
$('.actuallength').editable( function( sValue3 ) {
var aPos = oTable.fnGetPosition( this );
var aData = oTable.fnGetData( aPos[0] );
aData[ aPos[1] ] = sValue3;
actuallength = sValue3;
//alert("actualprice"+actualprice);
return sValue3;
}, { "onblur": 'submit' } );
oTable = $('#example').dataTable();
$('.actualwidth').editable( function( sValue4 ) {
var aPos = oTable.fnGetPosition( this );
var aData = oTable.fnGetData( aPos[0] );
aData[ aPos[1] ] = sValue4;
actualwidth = sValue4;
//alert("actualprice"+actualprice);
return sValue4;
}, { "onblur": 'submit' } );
oTable = $('#example').dataTable();
$('.actualheight').editable( function( sValue5 ) {
var aPos = oTable.fnGetPosition( this );
var aData = oTable.fnGetData( aPos[0] );
aData[ aPos[1] ] = sValue5;
actualheight = sValue5;
//alert("actualprice"+actualprice);
return sValue5;
}, { "onblur": 'submit' } );
oTable = $('#example').dataTable();
Add Comment Collapse

此代码将根据类名连续编辑5个单元格。