-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I'm trying to call a method in my ViewModel that has access to the item that was dropped into a listbox. I'm not sure how to achieve this though.
I have my backing list of objects in my VM and I was trying to send the command as such:
<listbox id="userSelectionsList" multiple="true" onDrop="@command('onCharacteristicDropped', item=event.draggable)" droppable="true">
In my controller, I can get onCharacteristicDropped to be fired, but I can't seem to get access to the item that was dropped.
@Command public void onCharacteristicDropped(@BindingParam("item") Component item) { logger.debug("On Characteristic Dropped item: {}", item); //item is always null
What's the best way to handle this?
Hi rickcr,
You can get trigger event in command function as below:
@Command public void onCharacteristicDropped(@ContextParam(ContextType.BIND_CONTEXT) BindContext ctx) { DropEvent event = (DropEvent)ctx.getTriggerEvent(); ... }
Regards,
Ben
I got it working with my first approach.. but I had to use the EE edition (6.0.1) with zkmax dependency. (Seems somewhat odd that you'd need the EE for what I'd think would be pretty common behavior for a UI using a ModelView approach.)
Asked: 2012-06-06 15:40:01 +0800
Seen: 170 times
Last updated: Jun 12 '12