fnScrollToRow isn't working in when updating column?
fnScrollToRow isn't working in when updating column?
Hai Allan. I am using Scroller with fixedColumns plugin in my table. Table have following two columns.
1.Number
2.name
Initially table is working fine.
Then I am updating Number column using popup dialog box.
In that update (column have start from number 1 to 1000.) I am updating 500th column, then I have changed it from 500 to 700, Now the scroller went to 700th column position. But fnScrollToRow isn't working after Number column update.. please help to get this answer in Number column update.
I have only included script code for your reference ..
How to pass updated column value to fnScrollToRow in when updating Number column or how reinitialize the datatable with pass updated column value to fnScrollToRow ?
My code is :
$(document).ready(function() {
// Section for datatable data for initial loading
result = $.parseJSON(result); (Json result for columns)
var oTable = initTable();
builddatatable(result);
new FixedColumns( oTable, {
"iLeftWidth": 300,
"iLeftColumns": 2,
} );
//updating Number column (Now this section fnScrollToRow isn't working after updating Number column )
$('#updateText').click(function(){
updatedRank = $('.rankInput').val();
$('.rankUpdate').dialog('close');
var oTable = initTable ();
builddatatable(result );
oTable.oScroller.fnScrollToRow(updatedRank -2 );
new FixedColumns( oTable, {
"iLeftWidth": 300,
"iLeftColumns": 2,
} );
}
} );
function initTable (){
return $('#contacttable').dataTable({
"sScrollY": calcDataTableHeight(),
"sDom": "rtiS",
"bAutoWidth": true,
"sScrollX": "800",
"bScrollCollapse": true,
"bRetrieve": true,
"bDeferRender": true,
"aoColumnDefs": [
{"fnRender": getNumber,"mDataProp": "Number", "sType": "Rank", "aTargets": [ 0 ],sDefaultContent: ""},
{"fnRender": getName,"sClass": "Name", "mDataProp": "Name", "bUseRendered":false,"aTargets": [ 1 ],sDefaultContent: ""}
]
});
}
// build the datatable.
function builddatatable(result){
jsonResult = result;
$('#contacttable').dataTable().fnClearTable();
$('#contacttable').dataTable().fnAddData(result);
}
function getNumber(oObj){
if(oObj.aData.rank != null )
return ''+ oObj.aData.rank+'';
else
return "";
}
function getName(oObj){
return ''+oObj.aData.Name+'';
}
1.Number
2.name
Initially table is working fine.
Then I am updating Number column using popup dialog box.
In that update (column have start from number 1 to 1000.) I am updating 500th column, then I have changed it from 500 to 700, Now the scroller went to 700th column position. But fnScrollToRow isn't working after Number column update.. please help to get this answer in Number column update.
I have only included script code for your reference ..
How to pass updated column value to fnScrollToRow in when updating Number column or how reinitialize the datatable with pass updated column value to fnScrollToRow ?
My code is :
$(document).ready(function() {
// Section for datatable data for initial loading
result = $.parseJSON(result); (Json result for columns)
var oTable = initTable();
builddatatable(result);
new FixedColumns( oTable, {
"iLeftWidth": 300,
"iLeftColumns": 2,
} );
//updating Number column (Now this section fnScrollToRow isn't working after updating Number column )
$('#updateText').click(function(){
updatedRank = $('.rankInput').val();
$('.rankUpdate').dialog('close');
var oTable = initTable ();
builddatatable(result );
oTable.oScroller.fnScrollToRow(updatedRank -2 );
new FixedColumns( oTable, {
"iLeftWidth": 300,
"iLeftColumns": 2,
} );
}
} );
function initTable (){
return $('#contacttable').dataTable({
"sScrollY": calcDataTableHeight(),
"sDom": "rtiS",
"bAutoWidth": true,
"sScrollX": "800",
"bScrollCollapse": true,
"bRetrieve": true,
"bDeferRender": true,
"aoColumnDefs": [
{"fnRender": getNumber,"mDataProp": "Number", "sType": "Rank", "aTargets": [ 0 ],sDefaultContent: ""},
{"fnRender": getName,"sClass": "Name", "mDataProp": "Name", "bUseRendered":false,"aTargets": [ 1 ],sDefaultContent: ""}
]
});
}
// build the datatable.
function builddatatable(result){
jsonResult = result;
$('#contacttable').dataTable().fnClearTable();
$('#contacttable').dataTable().fnAddData(result);
}
function getNumber(oObj){
if(oObj.aData.rank != null )
return ''+ oObj.aData.rank+'';
else
return "";
}
function getName(oObj){
return ''+oObj.aData.Name+'';
}
This discussion has been closed.
Replies
Allan