ZK drang and drop and databinding [closed]

asked 2013-05-13 16:19:02 +0800

stalotto gravatar image stalotto
0 1

updated 2013-05-13 16:57:18 +0800

I'm having a problem with ZK binding and drag and drop feature. I have tow listbox:

    <listbox id="left" width="100%" model="@load(vm.contacts)" height="200px" draggable="true" droppable="true" onDrop="@command('move')">                      
            <listheader label="Contatto" align="center"  />
        <template name="model" var="contact">
            <listitem value="@bind(contact)" draggable="true" droppable="true" onDrop="@command('move')"> 
                <listcell src="/img/contact-icon_x32.jpg" label="@load(contact.person.surname.concat(' ').concat(contact.person.name))" />
    <listbox width="100%" id="right" model="@load(vm.contactsQuickKey)" height="250px" draggable="true" droppable="true" onDrop="@command('move')" >
             <listheader label="Etichetta" align="center"  />
             <listheader label="Contatto" align="center"  />
        <template name="model" var="contactQuickKey">
             <listitem value="@bind(contactQuickKey)" draggable="true" droppable="true" onDrop="@command('move')">
                     <textbox width="90%" value="@load(contactQuickKey.label) @save(contactQuickKey.label, before={'move', 'saveData', 'setLeftActivePage'})"/>
                 <listcell src="/img/contact-icon_x32.jpg" label="@load(contactQuickKey.contact.person.surname.concat(' ').concat(contactQuickKey.contact.person.name))" />

If I edit the textbox in the right listbox and then immediately, without clicking anywhere, I drag and drop a cell from the left one, the text I added disappears. The only way I can save the text is to use an onchange event, but it is very heavy.

Does anyone can give me a better solution?

Thank you very much!

delete flag offensive retag edit

The question has been closed for the following reason "the question is answered, right answer was accepted" by sjoshi
close date 2013-05-15 07:41:13


I think you can use @bind with textbox also

sjoshi ( 2013-05-14 06:39:20 +0800 )edit

I tried it, but I obtained the same behavior.

stalotto ( 2013-05-14 08:01:45 +0800 )edit

Is is possible to create a demo example in zk fiddle?

sjoshi ( 2013-05-14 10:48:09 +0800 )edit

I created a demo example at this link http://zkfiddle.org/sample/2t6r27o/24-drag-and-drop-test

stalotto ( 2013-05-14 13:19:30 +0800 )edit

The solution is to put instant=true in the textbox.

stalotto ( 2013-05-14 14:36:10 +0800 )edit

Question tools




Asked: 2013-05-13 16:19:02 +0800

Seen: 14 times

Last updated: May 13 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More