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