Delete row client side
Delete row client side
I have a datatable with a delete button above. So if someone select a row and presses the delete button, the row should disappear. My problem is, when i select one and click on delete, the row disapper just for a second and appears then again.
getRow and getColDef are just functoin, which gets data from a xml. So i don't want to delete data live from the xml. I want that someone can delete data from the table and at the end he can just push the button and a new xml file would be created.
At the end i want to create a button, which can be actuated. And if someone so delete the data he wanted to from the table and click on that button, the data from the table should then be written in a new xml-file.
Do you know what i mean?
[code]$(document).ready(function() {
var oTable = $('#' + dt).dataTable({
"aaData": getRow(), //Array
"aoColumns" : getColDef() //Array
});
$("#asdf tbody tr").click( function( e ) {
var oTable = $('#asdf').dataTable();
if ( $(this).hasClass('row_selected') ) {
$(this).removeClass('row_selected');
}
else {
oTable.$('tr.row_selected').removeClass('row_selected');
$(this).addClass('row_selected');
}
});
$('#Delete').click( function() {
var oTable = $('#asdf').dataTable();
var anSelected = fnGetSelected( oTable );
if ( anSelected.length !== 0 ) {
oTable.fnDeleteRow( anSelected[0] );
}
} );
}[/code]
getRow and getColDef are just functoin, which gets data from a xml. So i don't want to delete data live from the xml. I want that someone can delete data from the table and at the end he can just push the button and a new xml file would be created.
At the end i want to create a button, which can be actuated. And if someone so delete the data he wanted to from the table and click on that button, the data from the table should then be written in a new xml-file.
Do you know what i mean?
[code]$(document).ready(function() {
var oTable = $('#' + dt).dataTable({
"aaData": getRow(), //Array
"aoColumns" : getColDef() //Array
});
$("#asdf tbody tr").click( function( e ) {
var oTable = $('#asdf').dataTable();
if ( $(this).hasClass('row_selected') ) {
$(this).removeClass('row_selected');
}
else {
oTable.$('tr.row_selected').removeClass('row_selected');
$(this).addClass('row_selected');
}
});
$('#Delete').click( function() {
var oTable = $('#asdf').dataTable();
var anSelected = fnGetSelected( oTable );
if ( anSelected.length !== 0 ) {
oTable.fnDeleteRow( anSelected[0] );
}
} );
}[/code]
This discussion has been closed.