Disable ajax button when no row are selected
Disable ajax button when no row are selected
ftaurino
Posts: 7Questions: 0Answers: 0
hi all,
I've an ajax button used to do someting on selected rows, but when no row is selected, the action
is done on all the rows in the table. how can I disable the button when no row are selected?
like the "select_none" button...
many thanks,
francesco
I've an ajax button used to do someting on selected rows, but when no row is selected, the action
is done on all the rows in the table. how can I disable the button when no row are selected?
like the "select_none" button...
many thanks,
francesco
This discussion has been closed.
Replies
Or just extend the select_none button, to do other actions, I guess, not sure if it would still keep his original function.
But using the API works for sure.
[code]
"fnSelect": function( nButton, oConfig ) {
if ( this.fnGetSelected().length !== 0 ) {
$(nButton).removeClass('DTTT_disabled');
} else {
$(nButton).addClass('DTTT_disabled');
}
},
"fnComplete": null,
"fnInit": function( nButton, oConfig ) {
$(nButton).addClass('DTTT_disabled');
},
[/code]
but the button, even if with css class "DTTT_disabled", can be clicked and make the associated php script start....
Allan
"fnClick": function ( nButton, oConfig, oFlash ) {
if(confirm("Marcare come GESTITO e inviare i messaggi?")){
var sData = this.fnGetTableData(oConfig);
$.ajax( {
"url": oConfig.sAjaxUrl,
"data": [
{ "name": "tableData", "value": sData }
],
"success": oConfig.fnAjaxComplete,
"dataType": "json",
"type": "POST",
"cache": false,
"error": function () {
alert( "Errore durante aggiornamento!!! - ERR001" );
}
} );
}
},
is there a way to _not_ include the "$.ajax" or make it simpler?
Allan