action: remove
action: remove
Can anyone tell me how i can delete a row from the table. The following Form Data is sent when i click on Delete:
action:remove
table:
id:
data[]:
There is no data. How can i send my own ID so that the data can be deleted from the DataBase?
[code]
$('#cashierTable').dataTable( {
"destroy": true,
"sAjaxSource": "/DataWarehouseWeb-1.0-SNAPSHOT/RetailSnapshot/plugins/datatables/sources/employeeRead.jsp?Whs=" + document.getElementById("whs_id").value,
"info": false,
"bDeferRender": true,
"bAutoWidth": true,
"scrollY": 100,
"scrollCollapse":false,
"paging" : false,
"order": [ 2, 'asc' ],
"jQueryUI": true,
"jQueryUI": true,
"columns": [
{"sName":"DS Id", "sTitle": "DS Id", "searchable" : true, "data": "dsId", "bVisible": true},
{"sName":"cId", "sTitle": "cId", "searchable" : true, "data": "cashierId", "bVisible": true},
{"sName":"First Name", "sTitle": "First Name", "searchable" : true, "data": "firstName"},
{"sName":"Last Name", "sTitle": "Last Name", "searchable" : true, "data": "lastName"},
{"sName":"Employee #", "sTitle": "Employee #", "searchable" : true, "data": "employeeNumber"},
{"sName":"Whs #", "sTitle": "Whs #", "searchable" : true, "data": "whs_num"},
{"sName":"Published", "sTitle": "Published", "searchable" : true, "data": "published"}
],
"oTableTools": {
"sRowSelect": "single",
"aButtons": [
{ "sExtends": "editor_create", "editor": editor_B, "sButtonText":"Add New Cashier","title":"Add New Cashier"},
{ "sExtends": "editor_edit", "editor": editor_B },
{ "sExtends": "editor_remove", "editor": editor_B },
/*{ "sExtends": "editor_create", "sButtonText": "Return to Over Short ==>" }*/
],
},
"dom" : '<"H"fT "cec"><"clear"><"F"ip"clear">'
} );
[/code]
[code]
editor_B = new $.fn.dataTable.Editor( {
"ajaxUrl": "/DataWarehouseWeb-1.0-SNAPSHOT/RetailSnapshot/plugins/datatables/sources/employeeEdit.jsp",
"domTable": "#cashierTable",
"type": "post",
"fields": [
{
"label": "DS ID",
"name": "dsId",
"type": "text"
},
{
"label": "Published",
"name": "published",
"type": "checkbox",
"default": "true",
"ipOpts": [
{ "label": "Published", "value": "true" }
]
},
{
"label": "Cashier Id",
"name": "cashierId",
"type": "text"
},
{
"label": "First Name",
"name": "firstName",
"type": "text"
},
{
"label": "Last Name",
"name": "lastName",
"type": "text"
},
{
"label": "Employee #",
"name": "employeeNumber",
"type": "text"
},
{
"label": "Whs Nr",
"name": "whs_num",
"type": "text",
"default": document.getElementById("whs_id").value
}
]
} );
[/code]
action:remove
table:
id:
data[]:
There is no data. How can i send my own ID so that the data can be deleted from the DataBase?
[code]
$('#cashierTable').dataTable( {
"destroy": true,
"sAjaxSource": "/DataWarehouseWeb-1.0-SNAPSHOT/RetailSnapshot/plugins/datatables/sources/employeeRead.jsp?Whs=" + document.getElementById("whs_id").value,
"info": false,
"bDeferRender": true,
"bAutoWidth": true,
"scrollY": 100,
"scrollCollapse":false,
"paging" : false,
"order": [ 2, 'asc' ],
"jQueryUI": true,
"jQueryUI": true,
"columns": [
{"sName":"DS Id", "sTitle": "DS Id", "searchable" : true, "data": "dsId", "bVisible": true},
{"sName":"cId", "sTitle": "cId", "searchable" : true, "data": "cashierId", "bVisible": true},
{"sName":"First Name", "sTitle": "First Name", "searchable" : true, "data": "firstName"},
{"sName":"Last Name", "sTitle": "Last Name", "searchable" : true, "data": "lastName"},
{"sName":"Employee #", "sTitle": "Employee #", "searchable" : true, "data": "employeeNumber"},
{"sName":"Whs #", "sTitle": "Whs #", "searchable" : true, "data": "whs_num"},
{"sName":"Published", "sTitle": "Published", "searchable" : true, "data": "published"}
],
"oTableTools": {
"sRowSelect": "single",
"aButtons": [
{ "sExtends": "editor_create", "editor": editor_B, "sButtonText":"Add New Cashier","title":"Add New Cashier"},
{ "sExtends": "editor_edit", "editor": editor_B },
{ "sExtends": "editor_remove", "editor": editor_B },
/*{ "sExtends": "editor_create", "sButtonText": "Return to Over Short ==>" }*/
],
},
"dom" : '<"H"fT "cec"><"clear"><"F"ip"clear">'
} );
[/code]
[code]
editor_B = new $.fn.dataTable.Editor( {
"ajaxUrl": "/DataWarehouseWeb-1.0-SNAPSHOT/RetailSnapshot/plugins/datatables/sources/employeeEdit.jsp",
"domTable": "#cashierTable",
"type": "post",
"fields": [
{
"label": "DS ID",
"name": "dsId",
"type": "text"
},
{
"label": "Published",
"name": "published",
"type": "checkbox",
"default": "true",
"ipOpts": [
{ "label": "Published", "value": "true" }
]
},
{
"label": "Cashier Id",
"name": "cashierId",
"type": "text"
},
{
"label": "First Name",
"name": "firstName",
"type": "text"
},
{
"label": "Last Name",
"name": "lastName",
"type": "text"
},
{
"label": "Employee #",
"name": "employeeNumber",
"type": "text"
},
{
"label": "Whs Nr",
"name": "whs_num",
"type": "text",
"default": document.getElementById("whs_id").value
}
]
} );
[/code]
This discussion has been closed.
Replies
Thanks,
Allan
[code]
editor.on( 'onPreSubmit', function ( e, data, action ) {
if ( action === 'remove' ) {
d.extra = 1; // etc
}
} );
[/code]
onPreSubmit documentation is available here: https://editor.datatables.net/api/#onPreSubmit .
Allan