@adamdawes-comgmail-com

@adamdawes-comgmail-com

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • in reply to: Is there an event that fires when a connection is removed? #111965
    Adam Dawes
    Participant

    Just for info I have managed to work around this by calling getConnections during the opening event and caching the results, and then when the itemRemove event fires, looking back in the cache to find the item with the provided connection id. This does allow me to then identify the tasks that were linked by the connection. It would be great if this data were available automatically however: the full information returned by getConnectionDetails should be available in the itemRemove event (including the startTask and endTask objects) rather than just the limited information currently available.

    in reply to: Is there an event that fires when a connection is removed? #111957
    Adam Dawes
    Participant

    Hi Markov,

    Thank you for highlighting this, I had overlooked that connections were treated as items too. That event does indeed fire with the type set as you describe.

    However I’m having trouble identifying which actual tasks were on each side of the connection. For example, for a connection I have deleted in testing, the detail object shows me the following:

    • id: “16-17-1”
    • item.source: 16
    • item.target: 17
    • item.type: 1
    • type: “connection”

    That’s all great, but it’s not including my task id values for the source and target tasks. The 16 and 17 appear to be internal indices into the Gantt chart tasks. How can I obtain the actual underlying task items from these two values in order to read their properties?

    I tried using the getConnections and getConnectionDetails methods to find the connection by its id (the data returned by these methods includes everything I need) but the deleted connection has already been removed by this point and is not recognised by either method. I tried calling getTask(event.detail.item.source) but this just returned undefined.

    What am I missing?

    Thanks,

    Adam.

Viewing 2 posts - 1 through 2 (of 2 total)