You are basically editing the data in this case, so I would suggest that you send an edit request to the server with the boolean value set as required. If you have a where condition set on the sever-side side script it will then just filter those values out.
The easiest way is probably to have a second editor instance on the client-side that provides the ability to set that field field.
I think this is a good topic for a blog post - I'll write it up soon.
I've the message
uncaught exception: Unable to automatically determine field from source. Please specify the field name. For more information, please refer to https://datatables.net/tn/11
I use a hidden field with budget.suppression but it does'nt work...
I'd really need a link to the page showing the issue, as I requested above I'm afraid. I need to be able to debug the live script and view the data that is being set to and from the server.
So can i refresh the datatable like the bubble or the remove function because when i edit the field 'budget.suppression', i want to take of the row of my datatable but not remove in the database.
Sounds like an error in the server-side code. I don't know what server-side code you are using, and I don't know what the full client-side code you are using is. I would need that information to be able to offer any help.
Answers
Do you have an answer please ?
You are basically editing the data in this case, so I would suggest that you send an edit request to the server with the boolean value set as required. If you have a
where
condition set on the sever-side side script it will then just filter those values out.The easiest way is probably to have a second editor instance on the client-side that provides the ability to set that field field.
I think this is a good topic for a blog post - I'll write it up soon.
Regards,
Allan
Thank you Allan,
I find a solution but i can improve my script
The solution
$('#example').on('click', 'a.editor_remove', function (e) {
editor
.edit(null,false)
.set( 'budget.suppression', 1 )
.submit();
} );
I have a probleme.
When i use the script (published june 22),
I've the message
uncaught exception: Unable to automatically determine field from source. Please specify the field name. For more information, please refer to https://datatables.net/tn/11
I use a hidden field with budget.suppression but it does'nt work...
Best regards,
NIcolas
I'd need a link to a test case showing the issue to be able to offer any help.
Allan
If you can't help me with this screenshot, i share my script.
My example works with localhost but when i send on my server (screenshot)... It does'nt work !
I search an other solution with this exemple : https://editor.datatables.net/examples/bubble-editing/inTableControls.html#
I want to use the delete example to edit one field of my database.
$('#example').on( 'click', 'a.remove', function (e) {
editor
.title( 'Edit one field of my database' )
.buttons( { "label": "edit", "fn": function () { editor.submit() } } )
.edit( $(this).closest('tr') ).set( 'budget.suppression', 1 ); ???
} );
Moreover I need to reload the page...
Can i do like the remove function ? --> Remove the datatable' row but not delete in the datatable.
I'd really need a link to the page showing the issue, as I requested above I'm afraid. I need to be able to debug the live script and view the data that is being set to and from the server.
Allan
Thank you for your quick response.
It's very strange because when i test it on IE9, it's work but the script redirect on the index.php ?!
I prepare the script and the database and i send it. What is your adress ? I don't want to post it on the forum.
Thank you Allan,
Best regards,
Nicolas
I think it's more easy to explain my problem like this
With the example
https://editor.datatables.net/examples/simple/inTableControls.html
I use
// Edit record
$('#example').on('click', 'a.editor_edit', function (e) {
editor
.edit(null,false)
.set( 'office', 'test' )
.submit();
} );
I want to update office (and insert the value test) in the clicked row...
But it doesn't work...
You need to pass in the row into the
edit()
method. Otherwise it doesn't know what row to edit!Allan
Ok,
My script works
e.preventDefault();
editor
.edit($(this).closest('tr'),false)
.set( 'budget.suppression', 1 )
.submit();
So can i refresh the datatable like the bubble or the remove function because when i edit the field 'budget.suppression', i want to take of the row of my datatable but not remove in the database.
Thank you for your time.
Best regards
Nicolas
Hello Allan,
I'm sorry but I still have my problem.
I use this script and it's work but in my server script, i have a condition
->where( 'budget.suppression', '0', '=' )
When i use the edit
$('#budget').on('click', 'a.editor_remove', function (e) {
The problem : the page reload. I lost my POST variables and the datatable reload...
I want to use the remove function but only edit the 'suppression' field and take of the row of my datatable... not delete the row of my database !
Have you got a solution ?
Best regards,
Nicolas
I'd need a link to the page showing the issue please. My guess is you might need to add:
but without being able to see the full page, I'm just guessing.
Allan
Ok but when i use the e.preventDefault(); i've got this message
SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens
'budget.suppression' is an hidden field.
I send you an example.
Thank you very much,
Nicolas
Sounds like an error in the server-side code. I don't know what server-side code you are using, and I don't know what the full client-side code you are using is. I would need that information to be able to offer any help.
Allan