Change the action of the create or edit button in the editor
Change the action of the create or edit button in the editor
Hi
I have my data table fill with information and will use the editor for adding and editing rows.
I have a great doubt, I want to change the actions of the buttons, for example when I click in create, I don't want to create a new row I just want an alert that says you will create a new record in the future.
How do I do this?
I am asking this, because I will need to create the events for adding and editing because I am using jsp no php. So I need to understand how does the editor works. Thanks in advance.
[code]
var editor; // use a global for the submit and return data rendering in the examples
$(document).ready(function() {
editor = new $.fn.dataTable.Editor( {
"bProcessing": true,
"sAjaxSource": 'tomacorrienteslist.jsp',
"domTable": "#example",
"fields": [ {
"label": "Codigo",
"name": "codigo"
}, {
"label": "Descripcion",
"name": "descripcion"
}, {
"label": "XBee",
"name": "xbee_id"
}
]
} );
$('#example').dataTable( {
"bProcessing": true,
"sAjaxSource": 'tomacorrienteslist.jsp',
"sDom": "<'row-fluid'<'span6'T><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
"aoColumns": [
{ "mData": "codigo" },
{ "mData": "descripcion" },
{ "mData": "xbee_id" }
],
"oTableTools": {
"sRowSelect": "single",
"aButtons": [
{ "sExtends": "editor_create", "editor": editor },
{ "sExtends": "editor_edit", "editor": editor },
{ "sExtends": "editor_remove", "editor": editor }
]
}
} );
} );
[/code]
I have my data table fill with information and will use the editor for adding and editing rows.
I have a great doubt, I want to change the actions of the buttons, for example when I click in create, I don't want to create a new row I just want an alert that says you will create a new record in the future.
How do I do this?
I am asking this, because I will need to create the events for adding and editing because I am using jsp no php. So I need to understand how does the editor works. Thanks in advance.
[code]
var editor; // use a global for the submit and return data rendering in the examples
$(document).ready(function() {
editor = new $.fn.dataTable.Editor( {
"bProcessing": true,
"sAjaxSource": 'tomacorrienteslist.jsp',
"domTable": "#example",
"fields": [ {
"label": "Codigo",
"name": "codigo"
}, {
"label": "Descripcion",
"name": "descripcion"
}, {
"label": "XBee",
"name": "xbee_id"
}
]
} );
$('#example').dataTable( {
"bProcessing": true,
"sAjaxSource": 'tomacorrienteslist.jsp',
"sDom": "<'row-fluid'<'span6'T><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
"aoColumns": [
{ "mData": "codigo" },
{ "mData": "descripcion" },
{ "mData": "xbee_id" }
],
"oTableTools": {
"sRowSelect": "single",
"aButtons": [
{ "sExtends": "editor_create", "editor": editor },
{ "sExtends": "editor_edit", "editor": editor },
{ "sExtends": "editor_remove", "editor": editor }
]
}
} );
} );
[/code]
This discussion has been closed.
Replies
[code]
{
sExtends: "text",
fnClick: function ( button, config ) {
alert( 'Wotcha!' );
}
}
[/code]
Allan
I still want it. (It looks cool)
Allan
instead of calling the alert(Hello)
[code]
function showDialog()
{
$("#dialog-modal").dialog(
{
width: 600,
height: 400,
open: function(event, ui)
{
var textarea = $('');
$(textarea).redactor({
focus: true,
autoresize: false,
initCallback: function()
{
this.set('Lorem...');
}
});
}
});
}
[/code]
I want to call the showDialog(),
It will be this way
[code]
{
sExtends: "text",
fnClick: function ( button, config ) {
showDialog();
}
}
[/code]
Allan
No dialog is show. I am wondering which is the problem :(