SOLVED: How to drag and drop rows from Lister into another OP?

Hello all,

I would like to drag a row from Lister into another component and run a drop script.
How is this achieved? I can drop the whole node in and it works, but not when I click and drag a row.

Thanks,
Tim

Made some examples. Not sure how familiar you are with setting up lister… if you need more details just ask.
listerDrops.1.toe (10.3 KB)

Thank you Ivan!
This is exactly what I’m looking for.
-Tim

@Ivan is there a best practice way in 2021 to do dragdrop callbacks from lister beyond drop Surrogate? I want to be able to do things like dragging onto parameters and making dynamic references, and I’m wondering if any of the flexibility of the new system is implemented in recent Lister

Alas, listCOMP has not been brought up to the modern drag/drop system standards. It’s in the plan for upcoming releases, though.

1 Like

any idea if this is a this year kind of thing? Trying to to weigh how heavily I should invest in a workaround

Yes, this is planned for the next release

In 38110 is dragging from the lister to a parameter field supported? I would very much like to return a path to an operator at info[‘rowObject’][‘path’] when dragging a row from lister to a par field. Some docs or an example on achieving this would be greatly appreciated

Here’s how you get the lister’s row data object in the drag/drop callbacks for the lister:

cell = info[‘listCell’]
rowData = comp.Data[cell.row]

You can then do

return rowData[‘rowObject’][‘path’]

I’m gonna put this in the wiki right now. Cheers!

I still seem to be missing something here… I can get the drag to work when dragging from an unpopulated part of the lister, but with columns set to draggable and your script example, I’m still not getting anything from the onDragStartGetItems callback when dragging from a cell.

first of all, the Do Not Allow Drop option no longer exists, so my best bet is option is use parent drag/drop?

I can force something to happen with an onMouseDrag callback that mods the dragdrop script, but that doesn’t initiate whatever you’ve got going on under the hood that instigates a viable drop location, so that isn’t doing the trick.

The other issue is that if it needs a returned True from onDropHover on the other end, it means i can’t drag into a network or parameter, which is the main functionality I’m looking for. I’d like to be able to drag a row or cell from lister, return that row’s ‘path’ column value, and drop it into a parameter elsewhere in my network to create a reference. Is there a way to test if the drop target is a parameter and return a path, or network editor pane to copy the referenced path op?

Is there any update on this?

I’m trying to drag and drop from one lister to another within a single window. Following the example by @Ivan this does work but not within the same network. It also does not work with floating windows. I’m trying to create a user interface in a single window with two listers where i can drag and drop from one to another. Is there a work around?

We’ve worked on this some. Can you post your network, or a simplified version with instructions for testing. I’ll either get it to work or get the bug fixed!

Also @drmbt I see I never answered your question above… did you get unstuck?

I think I solved my issue by modifying userExpectations.txt in my local directory :wink:

Was so long ago, I can’t even remember what I was hoping to accomplish, but I think it involved dragging items from lister to the network editor, or from outside of TD into lister, neither of which returned the callbacks I was hoping for at the time. Has that changed in the last year?

Nope, it hasn’t

@Ivan

Thanks for looking into this. See attached examle:

drop in lister.toe (52.5 KB)

Ah, yes. This problem was discovered in this thread: How to use drag and drop system in Lister Comp - #9 by Ivan

It will be fixed in the next release, and there’s a workaround at the end of the thread.

Thank you Ivan!

Quick second question:
op('lister1').AddRow(rowNumber=None, rowData={"Name":"test"}, rowObject='__no__object__', rowDict=None, addUndo=True)
give me rowObject key error. The documentation says I have to add a rowObject key to the dictionary but that would be the content of the key?

This is a bit hard to answer without seeing your network, but my guess from what you have here is that what you want is actually:

op(‘lister1’).AddRow(rowNumber=None, rowDict={“Name”:“test”}, addUndo=True)

This builds the rowObject and rowData out of the provided rowDict.

If this doesn’t work, attach your network and the results you’re trying to get and I’ll see if I can help.

Yes that did the trick, thank you!

1 Like