No datatable update after insert

No datatable update after insert

nessinitsnessinits Posts: 86Questions: 27Answers: 0

Hi all,

I'm new to this. I've just generated a custom datatable with the generator. The weird thing is that everything works well, but only after inserting a new record the datatable isn't updated. After an update or delete it is.

Does anyone know what might be the case here?

Kind regards.
nessinits

Replies

  • nessinitsnessinits Posts: 86Questions: 27Answers: 0

    I think I know what's going wrong, but how to solve it ... I don't know, but perhaps anyone can help me out.

    When I generate the code it uses an auto increment on the id. However I'm handling a legacy database with a trigger on the id (that generates a unique identifier). So I haven't created the table as in the generated sql file.

    I just don't get why this is halting the proces of redrawing the table. Any thoughts?

  • allanallan Posts: 63,871Questions: 1Answers: 10,525 Site admin

    When Editor inserts the new row it then needs to be able to read the data back and send it to the client (this allows for any server generated fields such as a created time, updated by field, etc) - the table is then drawn with that data.

    So if Editor isn't able to read the data back from the newly inserted row, this falls apart and you get the effect you are seeing - no redraw. Editor uses the id column to be able to uniquely read the row back after an insert and it uses the PDO lastInsertId() method in order to be able to determine that id (at least in the PHP version).

    Having said all that, I would normally expect a AFTER INSERT trigger to work without an issue since that will be executed almost immediately. What is the trigger you are using? Moreover, what is the database engine and what server-side platform are you using?

    Allan

This discussion has been closed.