Handling item transferring on double click

8 posts, 0 answers
  1. Oded
    Oded avatar
    21 posts
    Member since:
    Feb 2009

    Posted 18 Feb 2010 Link to this post

    Hello,

    I want to allow moving of items from one listbox to another by double clicking an item.
    I have a javascript function that checks if the move is allowed and I use it with the OnClientTransferring event.
    I want to use this function also with the OnClientItemDoubleClicking event but I don't have the same event arguments supplied.

    does anyone knows why isn't the OnClientTransferring invoked when transferring an item using double click?

    Thanks,
    Oded
  2. Joshua Holt
    Joshua Holt avatar
    23 posts
    Member since:
    Jan 2010

    Posted 19 Feb 2010 Link to this post

    HI Oded,
    You can accomplish this task by setting the 2 list boxes making the to list boxes related to each other by either setting the TransferToID in code, or in the ListBox control's smart tag, select the releated list box.  Then handle the double click event of both list boxes
    Javascript:
        function doubleClick(s, e) {            
                var item = e.get_item(); 
                s.transferToDestination(item); 
            } 

    Page:
    <telerik:RadListBox ID="RadListBox1" runat="server"  
            onclientitemdoubleclicked="doubleClick" TransferToID="RadListBox2"
            <Items> 
                <telerik:RadListBoxItem runat="server" Text="RadListBoxItem1" /> 
                <telerik:RadListBoxItem runat="server" Text="RadListBoxItem2" /> 
            </Items> 
        </telerik:RadListBox> 
        <telerik:RadListBox ID="RadListBox2" runat="server" TransferToID="RadListBox1" onclientitemdoubleclicked="doubleClick"
        </telerik:RadListBox> 
    Double clicking an item in ListBox1 will now send it to ListBox2,  double clicking in ListBox2 will send it to ListBox1.

    You could run your function to check if the move is allowed in the double click handler.

    You can see more ways to handle item transfer between list boxes on the RadListBox Client API Help Page.

    I hope this helps you!
    -Josh






  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Oded
    Oded avatar
    21 posts
    Member since:
    Feb 2009

    Posted 21 Feb 2010 Link to this post

    Thank you Josh,

    Maybe I was not so clear. I that the OnClientTransferring event will be fired when I transfer the item with double click. Or have similar event arguments in the OnClientItemDoubleClicking event.

    Thanks,

    Oded
  5. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 22 Feb 2010 Link to this post

    Hi Oded,

    The double click transfer fires the OnClientTransferring/Transferred events. You need to set the AllowTransferOnDouble click property of the source RadListBox to true and then add event handlers for the previous mentioned events. I have attached sample project that demonstrates this.

    Kind regards,
    Genady Sergeev
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  6. Oded
    Oded avatar
    21 posts
    Member since:
    Feb 2009

    Posted 23 Feb 2010 Link to this post

    Hello Genady,

    I don't know why but the OnClientTransferring is not firing when I double click on an item on the AvailableListBox but it does fire when I double click on an item on the SelectedListBox:

     <telerik:RadListBox ID="AvailableListBox" runat="server" TransferToID="SelectedListBox" 
          AllowTransfer="true" OnClientTransferring="clientTransferring" AllowTransferOnDoubleClick="true" 
          TransferMode="Move" Width="275" Height="400">  
          <ButtonSettings AreaWidth="30" ShowTransfer="true" ShowTransferAll="false" Position="Right" 
            VerticalAlign="Middle" /> 
        </telerik:RadListBox> 
    <telerik:RadListBox ID="SelectedListBox" TransferMode="Move" runat="server" 
          Width="245" Height="400" TransferToID="AvailableListBox" AllowTransferOnDoubleClick="true">  
        </telerik:RadListBox> 

    This markup is inside a user control. I have two user controls on the page and altogether four listboxes.

    Any Ideas?

    Thanks,
    Oded
  7. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 24 Feb 2010 Link to this post

    Hello Oded,

    I am not able to reproduce the issue, on my side the events is fired for both the source and the destination RadListBox. Which version of the controls are you using?

    Greetings,
    Genady Sergeev
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  8. Oded
    Oded avatar
    21 posts
    Member since:
    Feb 2009

    Posted 25 Feb 2010 Link to this post

    Hi,

    I Upgraded to the latest version and it didn't solve the problem.

    But I found what was the problem.

    Here you can see that on the SelectedListBox the TransferToID is set to the AvailableListBox. When I removed this attribute from the second RadListBox the event started to fire.
     <telerik:RadListBox ID="AvailableListBox" runat="server" TransferToID="SelectedListBox"   
          AllowTransfer="true" OnClientTransferring="clientTransferring" AllowTransferOnDoubleClick="true"   
          TransferMode="Move" Width="275" Height="400">    
          <ButtonSettings AreaWidth="30" ShowTransfer="true" ShowTransferAll="false" Position="Right"   
            VerticalAlign="Middle" />   
        </telerik:RadListBox>   
    <telerik:RadListBox ID="SelectedListBox" TransferMode="Move" runat="server"   
          Width="245" Height="400" TransferToID="AvailableListBox" AllowTransferOnDoubleClick="true">    
        </telerik:RadListBox>   
     

    So the working markup is:
     <telerik:RadListBox ID="AvailableListBox" runat="server" TransferToID="SelectedListBox"   
          AllowTransfer="true" OnClientTransferring="clientTransferring" AllowTransferOnDoubleClick="true"   
          TransferMode="Move" Width="275" Height="400">    
          <ButtonSettings AreaWidth="30" ShowTransfer="true" ShowTransferAll="false" Position="Right"   
            VerticalAlign="Middle" />   
        </telerik:RadListBox>   
    <telerik:RadListBox ID="SelectedListBox" TransferMode="Move" runat="server"   
          Width="245" Height="400">    
        </telerik:RadListBox>   
     

    I guess this is a bug.

    Thanks,
    Oded
  9. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 26 Feb 2010 Link to this post

    Hello Oded,

    Thank you for pointing this out. Actually there is no need to set the TransferToID  property of the destination RadListBox. It is sufficient to set in on the source one and the transfer will work as expected.

    Regards,
    Genady Sergeev
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017