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 ZJohn Z Posts: 4Questions: 1Answers: 0
edited December 2016 in Free community support

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 () { });

Replies

  • allanallan Posts: 63,831Questions: 1Answers: 10,518 Site admin

    The event name is case sensitive in Javascript - it is preCreate (note the lower case p).

    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

  • John ZJohn Z Posts: 4Questions: 1Answers: 0
    edited December 2016

    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

  • allanallan Posts: 63,831Questions: 1Answers: 10,518 Site admin

    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

This discussion has been closed.