So I am using a field in 1 replicant to populate a list. My onChange event (field) and onReplicantAdd both call the same function to regen the list.But know I want to be able to, if a replicant is deleted, remove the entry. Easy I thought, onReplicantDelete call the same function. But No. This runs before the replicant is deleted. Is there an event I can trap after it is deleted ? I know I can write a different function for delete only (and would need t filter out the yet to be deleted replicant).Is there a better way ?
parent.IWDCEventRegistry.addListener('onItemRemoved', removeItemHandler);...function removeItemHandler(item) { // Check if you care... var xpath = getXPath(item); if (xpath.match('YourCollectionPattern')) { ... }}
If your circumstances allow little hacks you may use Listeners. There, 'onItemRemoved' fires after removal.If you do, make sure that:a) You register an event listener only once andb) Check an event source to filter out *false positives* (you will catch a removal of any replicants, not only desired ones) Code:[left]parent.IWDCEventRegistry.addListener('onItemRemove d', removeItemHandler);...function removeItemHandler(item) { // Check if you care... var xpath = getXPath(item); if (xpath.match('YourCollectionPattern')) { ... }}[/left]
I do not intend to intrude buty the approach suggested by ISCBorisB interests me...never tried it before..... ISCBorisB, would you have the time tio eloborate it a bit further? That would be great... Forgive me if it is an "RTFM" stuff
Does the following still works?parent.IWDCEventRegistry.addListener('onItemRemoved', removeItemHandler);I see that last posting of that item was back in 2007. I tried to use this hack yesterday and it does pass the item to the declared method however the getXPath or getName methods fail to get the path of the item. Any help on that would be greatly appreciated.