Copy multiple rows between repeaters

repeater-widget

#1

Hi guys,
I’m having two repeaters side by side with a tree structure on every side (inspired by other topics from this forum). The left side is a kind of library (all items will stay there) and I can dragand copy items to the right list. This works fine with single items. But now I want to copy parent items including their childs to the right side by dragging. To simplify a little, open trees are closed at strat dragging. So visually only one parent item is moved. After copying I want to be able to open that parent item and see the childs.
I tried around a lot but was not successfull. As I saw in another topic, there is a way by marking the rows (seems to work for me), setting the current page of the repeater to trigger the itemsload event and then adding the rows to the other repeater from the event. But it doesn’t work in my case.

Could someone please help me?
ListManagment.rp (785.6 KB)


Drag multiple items
#2

This behavior seems to be caused by filtered repeaters. I am not able to mark invisible rows. Is there a way to mark them?


#3

You may be able to do your own version of marking by having a column called “marked” set to true/false and using Update Rows / This to set it etc.

Its very simple. In the practical sense there’s pretty much no significant difference between using “official” marked rows and a column called “marked”


#4

Thank you.
This is also not working because I cannot iterate through invisible Items in the event item loaded.
Here is a small test rp file.
Item A and B are filtered out by repeater field depth. When I iterate through the items loaded the filtered ones are not copied.
Add_Multiple_Rows.rp (73.3 KB)


#5

The solution in this case is use an iterator other than Item Loaded. In your Drag Dropped code, fire something like the Moved event on item_ListA. The Moved even code will be called for every item in the Repeater, regardless of whether it is visible or not.


#6

Thank you for your help.
Unfortunately I cannot make it running.

  • having a column in repeater called depth
  • firing Moved event for the item_ListA widget
  • in case of depth = 1 add that row to the listB

This only works for the dragged row.
It does not iterate through all of them.
What am I doing wrong?

Could you please have a look at the rp file?
I stripped it down to the necessary part.
Add_Multiple_Rows_v2.rp (72.8 KB)


#7

So I couldn’t find a way around the issue of filtered items not firing their “OnItemLoad” event. However there are some “smoke-and-mirrors” ways you could fake it.

If there are limitations on what what each list can contain, like the number of items available in the “Library” is set and you can’t copy over a library item more than once, both repeaters could be identical and the drag-drop just sets a filter to show what items were “copied” over.

If you need more flexibility and really want to add new rows to a repeater, the best I was able to come up with was to unfilter “Library” so the child rows would load and just hide the whole thing with a fake list: Copy_Children.rp (808.8 KB)

Fair warning: My example does not use your method for creating repeater “tree views”. I learned a different way and used it just so it was easier for me to experiment with trying to find a solution. You should be able to adapt the basic approach to fit what you need.


#8

Hi @huban,
yes I need the flexibility of adding rows. Imagine the MyList is a kind of custom area, where I can copy things from the library and customize as much instances as I want.
So your fake list solution is very interesting for a prototype.

Just tried that out and it works perfectly.

Thank you very much.


#9

You could do it that way (just using a hidden repeater as the actual source of copy), and it might be a little easier way to go about it. That’s not what’s happening in the project I uploaded, though.

While there is a third repeater in there it doesn’t have to be, I just used it because I’m lazy. :wink:

All you need is something to mask the real repeater while it’s unfiltered. It could be just an image of the collapsed library or a progress indicator, whatever else you want: Copy_Children.rp (915.4 KB)


closed #10

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.