Question

I've populated my prime-ui PickList with some data and I'm able to transfer them between the available/left and selected/right list. PrimeUI supports a transfer function which is called when an item is transfered as shown in the PickList Showcase:

$('#default').puitree({
  transfer: function(event, ui) {
    //ui.items: Transferred items.
    //ui.from: Old list.
    //ui.to: New list.
    //ui.type: Type of transfer e.g. "dragdrop","button" and "command"
  }
});

If I add an object and inspected the ui element, it contains following values (taken from Firebug)

ui.from:         Object [ul.ui-widget-content]
ui.from.context: ul.ui-widget-content
ui.to:           Object [ul.ui-widget-content]
ui.to.context:   li.pui-picklist-item
ui.items:        Object [li.pui-picklist-item]
ui.type:         "dragdrop"

If I remove an object and inspect the ui element, it contains following values (taken from Firebug)

ui.from:         Object [ul.ui-widget-content]
ui.form.context: ul.ui-widget-content
ui.to:           Object [ul.ui-widget-content]
ui.to.context:   li.pui-picklist-item
ui.items:        Object [li.pui-picklist-item]
ui.type:         "dragdrop"

The same applies for the event element. No useful information to retrieve.

Question: How do I know in which direction the transfer is going? I have no clue!

Was it helpful?

Solution

I had to create my own solution. It was simple a datastructure which was initialized with the items on the 'available' list as well with the items on the 'selected' list. When an item was transfered I simply checked where the item was e.g., 'selected' and then I moved it to the 'available' list.

I tried several other solutions but nothing worked. This was the easiest solution I could think of.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top