About editor.create
About editor.create
f.talamini@stmingegneria.eu
Posts: 23Questions: 11Answers: 0
in Editor
Hello, i need to add rows to a datatable and it mysql database:
Using this code:
editor
.create( false )
.set( 'name', 'Test user' )
.set( 'access', 'Read only' )
.submit();
It seems I can't store my values. If I erase the set part it work perfectly!
How can I store my values?
Thank you,
Regards,
Franco.
This question has accepted answers - jump to:
This discussion has been closed.
Answers
Can you give me a link to a page showing the issue please? That looks like it should work absolutely fine.
Allan
The demo page is: www.bollettamia.it/test/addrow.php
There are 2 custom buttons: copy and paste. When you push copy the selection of rows is copied into an array and when you push paste the editor.create(false) is called in a each loop and then the fields in the copied row are copied into the newly created row.
It seems the .set funcion is not member of the new row.
The error code is:
SCRIPT5007: Unable to get property 'set' of undefined or null reference
dataTables.editor.min.js (56,180)
Thank you,
Franco
Hi Franco,
You can't really use Editor's
create()
method in a loop. Because the Ajax submit is async, you need to submit one, wait for it to complete and then submit another.So you have two options:
Allan
Thank you Allan.
Franco
I was trying to use the multi-row editing APIs but I still have the same problem: the create and submit methods work properly while the multiSet doesn't: it seems editor.multiSet doesn't exist!
the sample code is on http://bollettamia.it/test/addrow.php
Thank you,
Franco
The error is occurring because there is no field by the given name. For example you have
K: c3
, but there is no field calledK
in the Editor instance. It is calledServizi.K
. The object property names need to match those used in the Editor configuration.Allan