You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to know how I can have a listener when a user clicks on "+Item" when adding Array (or Object) Item.
I can listen to : editor.watch('root.MY_ARRAY',function() but this listen indifferently to an existing Item modification or a new Item. And as I need to perform some specific actions on item creation, I would like to be able to differentiate them !
Thank for highlighting me !
The text was updated successfully, but these errors were encountered:
There's no built in way to listen to add events, but you can do something like this:
varprevious_array_length=0;editor.on('change',function(){// Get your array valuevararr=editor.getValue().MY_ARRAY;// If array has grown in sizeif(arr.length>previous_array_length){// do something}// Update current array lengthprevious_array_length=arr.length;});
Hi !
I would like to know how I can have a listener when a user clicks on "+Item" when adding Array (or Object) Item.
I can listen to : editor.watch('root.MY_ARRAY',function() but this listen indifferently to an existing Item modification or a new Item. And as I need to perform some specific actions on item creation, I would like to be able to differentiate them !
Thank for highlighting me !
The text was updated successfully, but these errors were encountered: