Select Last Inserted Row, Table Desc Order

Select Last Inserted Row, Table Desc Order

vincmeistervincmeister Posts: 136Questions: 36Answers: 4

Hi Allan,

I want to select last inserted row on post submit, but no luck.
My table is ordered by tr_in_id DESC

I'm using this code, but it select the 1st tr_in_id
I'm changing to :first, the selection result also same

trReceivingHeadEditor.on('postSubmit', function( e, json, data, action ) {
                trReceivingHeadTable.rows(':last').select()
            });

Please advise, thank you

This question has an accepted answers - jump to answer

Answers

  • bworsfoldbworsfold Posts: 14Questions: 4Answers: 0

    What I do is flag the new row created using a class. I can then get the row easily. and remove the class if need be.

  • allanallan Posts: 61,323Questions: 1Answers: 10,023 Site admin
    Answer ✓

    :last as a selector would only work if it is inserted into the last position in the table. Perhaps a better option would be to select by id, which you should have access to in the json response.

    Allan

This discussion has been closed.