3 buttons next to each row for CRUD operation in a different page
3 buttons next to each row for CRUD operation in a different page
Hello
What i want to implement is the following:
I want 3 buttons , text or image, next to each row. I will use this button for Editing, Deleting, Viewing of a row within a different page.
What should i use to achieve that ? I do not ask to give me the exact code, just to point me out what function, methods, plugins i need to use.
Best Regards
What i want to implement is the following:
I want 3 buttons , text or image, next to each row. I will use this button for Editing, Deleting, Viewing of a row within a different page.
What should i use to achieve that ? I do not ask to give me the exact code, just to point me out what function, methods, plugins i need to use.
Best Regards
This discussion has been closed.
Replies
What is the data source you are using for the table? If it is just a plain HTML table, then you should do it in exactly the same way as you would with a table that isn't being enhanced in DataTables - i.e. put the add, edit and delete links to the separate page into columns at the end of each row.
If you are using server-side processing or Ajax sourced data, then you can take the same approach again - just put the links to the add, edit and delete pages into the returned arrays. An alternative to this would be to use the column rendering function (fnRender) to add the links into the columns.
Regards,
Allan
I'm using server side proccessing with PostgreSQL and PHP. I'm using your example file. Can u show me some code of how this can be done ? I thought you already had some ready made function for this and that is why I didn't ask for code.
Thanks
[code]
fnRender: function (o) { return 'Edit'; }
[/code]
Allan
I read the manual about fnrender() and added this code to my app:
[code]
"aoColumnDefs": [
{
"fnRender": function (o) {
return 'Edit';
},
"aTargets": [ 0]
}
]
[/code]
This works and puts the 'edit' link in the first column but omits the values of the first column.
I tried to create one more column named 'actions' so i will put the link there.
I changed the "aTargets": [ 0] to "aTargets": [ 14] to match the columns' number. However i get an error message that the data returned from the server do not match the number of columns which it is true since i use the fnrender function.
Please enlighten me how to provide 3 different links that will take the id of the specific row so they can post after to the edit - view - delete page accordingly.
Thanks
Allan
Waiting for your reply
Thanasis
[code]
$output['aaData'][] = $row;
[/code]
which is very near the end, to:
[code]
$row[] = '';
$row[] = '';
$row[] = '';
$output['aaData'][] = $row;
[/code]
so just adding three empty string elements to the row array.
Allan