Update multiple rows using Customised control button
Update multiple rows using Customised control button
Info: I am using the free version of Editor in order to test it, and I'll get a licence if I can make it work.
I want to display a button to activate users (in the database, it is just a "activated" column set to "0" or "1").
So far so good, I am using the customised control button :
var activateEditor = new $.fn.dataTable.Editor( {
ajax: {
type: 'PUT',
url: 'activateUser.php',
},
table: "#data-table"
});
tableTools: {
sRowSelect: "os",
aButtons: [
{ sExtends: "editor_edit", editor: editor },
{ sExtends: "editor_remove", editor: editor },
{
sExtends: 'select_single',
sButtonText: 'Activate',
fnClick: function () {
if ( table.row( '.active' ).length !== 0 ) {
activateEditor
.edit( table.row('.active').node(), false )
.submit();
}
}
}
]
}
I can get the row ID with the .edit( table.row('.active').node(), false )
, which is perfect.
But I would like to be able to get multiple rows ids, in order to batch activate users.
So I first turn sExtends: 'select_single'
into sExtends: 'select'
, but the .edit( table.row('.active').node(), false )
still only returns a single row ID.
The default sExtends: "editor_remove"
is quite nice because it returns an array of row Ids, and this is what I want to achieve with my activateEditor
function.
For information, I am using Laravel framework to handle the ajax calls.
This question has an accepted answers - jump to answer
Answers
Multi-row editing is not a feature that is available in Editor 1.4-. It is a single row editor only.
v1.5, which will be available next month will feature the ability to edit multiple rows.
Allan
Hi allan, is it currently possible to edit multiple rows?
Thanks in advance
Manuel
Hi Manuel,
As noted in my reply above, no, multi-row editing is not available in v1.4. It will however be a feature that is available in v1.5 which will be available within the next few weeks.
Regards,
Allan