Stop row creation in Editor

Stop row creation in Editor

johnblythejohnblythe Posts: 92Questions: 21Answers: 2

Hey there,

Is there a way to stop the Datatable from adding a row after the creation event? I'm looking at the preCreate event (https://editor.datatables.net/reference/event/preCreate), but am not sure if I can do anything besides modify the data itself sent to the triggered fnAddData.

Use case: crossing products with other products. Create a new product to be crossed inline with another and thus have the new data filled in to that row via Datatable and thus don't need a new row created to represent the new product.

Thanks for any insight-

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,805Questions: 1Answers: 10,119 Site admin
    Answer ✓

    You could use postSubmit to intercept the JSON returned from the server and empty the data array that is returned. If Editor doesn't see any returned data it won't add anything (this is Editor 1.5+).

    Allan

  • johnblythejohnblythe Posts: 92Questions: 21Answers: 2

    Boom. Thank you!

This discussion has been closed.