postCreate (onPostCreate) does not seem to fire
postCreate (onPostCreate) does not seem to fire
bvelasquez
Posts: 28Questions: 7Answers: 0
Does anyone have this problem?
I have tried the old and new name.
I init the editor with the following:
var datatables_editor_detail_init = new $.fn.dataTable.Editor({
and add the event listener as follows:
datatables_editor_detail_init.on('onPostCreate', function (e, json, data) {
Reference:
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Here is what I am trying to do ~ I am trying to animate or call attention to the newley created row, such as a slidein or fade in. So I want to detect the addition of the item to the table, then trigger the css.
create()
https://editor.datatables.net/reference/event/create
Doesn't trigger either.
Hi,
Editor should actually already flash highlight the background colour of the row using the default CSS for exactly the reason you state - to draw attention to it. You can see that effect in the examples.
The issue here is probably that the events you mention happen before the new row has been added to the table. You'd need to do something like:
You also probably can't rely upon using
tr:last-child
since the sorting applied to the table might not place the row at that point.Sliding open a row is particularly difficult to do - if it is acceptable, use the background colour flash that Editor provides.
Allan
I don't understand...
These events are not firing:
That particular event is frankly useless now. The Editor initialisation is entirely synchronous so there is no need for it. You would do:
Having said that, there isn't actually a
button().disable()
method in Editor! What's the goal?The other events such as
postCreate
should work though. If they aren't for you, could you link to a test case showing the issue so I can check it out?Thanks,
Allan
Hi Allan,
I have the following but the event does not fire.
I am using
to create the row]
Cheers
Steve Warby
That looks like it should trigger. If you could give me a link to the page showing the issue, I can take a look into it.
Allan