how to get the data inserted by the user with the new button for PreCreate Method
how to get the data inserted by the user with the new button for PreCreate Method
John Z
Posts: 4Questions: 1Answers: 0
Hi,
I am working with datatable 1.10.10 and Editor 1.5.4.
how can I get the a value of a user's inputs for the new Button before the row is created.
Example:
(Create Button)
Form Below:
FName:
LName:
Salary:
How can I retrieved the value inserted by the user for Salary in the PreCreate.
ExampleTblEditor.on('PreCreate', function () { });
This discussion has been closed.
Replies
The event name is case sensitive in Javascript - it is
preCreate
(note the lower casep
).What exactly do you want to do with the values? There are a number of places you can get it - e.g. before submission to the server, before writing to the DataTable, after writing to the DataTable.
Allan
Hi Allan,
Let's say the LName,
I want to retrieve the LName input by the user and search my data-table LName columns for the same LName retrieved, I want to delete any row that have that retrieved value, just from the UI.
Example
FName | LName
John Doe
Jack Steele
Inputs by the user
FName: John
LName:Doe
Results
FName | LName
Jack Steele
//delete any LName with Doe, and I only care about the user Interface.
I think I should be fine with both before writing to the Datatable and before submission for my requirements this is just an example.
Thanks,
John
Interesting one. I think you would need to use
submitComplete
for this. The reason for that is if you want the client-side Editor to make another call to the server to delete a row, that is where you have to do it.Another option would be to use a server-side event to delete the other rows. You'd then need to use
ajax.reload()
on the client-side to refresh the table since a row other than the one being edited might be removed from the table.Allan