Custom confirm on item clicking

4 posts, 0 answers
  1. Jacky Chau
    Jacky Chau avatar
    108 posts
    Member since:
    Jun 2005

    Posted 15 Mar 2008 Link to this post

    I am catching the OnItemClicking event of the menu and for a particular tool, such as Delete, I want to ask the user if they are sure they want to continue with a simple confirm dialog box.  I plan to use RadWindow's custom confirm but it doesn't block the execution of my code.  So how can I achieve this affect?  I am thinking I will return false to cancel the click and send in a callback function to RadWindow's confirm that will simulate the item being clicked if the user selects Yes.  Is this possible?  And will the OnItemClicking event fire again?
  2. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 18 Mar 2008 Link to this post

    Hi Jacky Chau,

    Yes, you are right - radcofirm dialog does not block the thread. You could simulate blocking the thread and achieve the desired behavior in the manner explained in this KB article. You can also find a sample running project there.

    All the best,
    Svetlina
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Jacky Chau
    Jacky Chau avatar
    108 posts
    Member since:
    Jun 2005

    Posted 18 Mar 2008 Link to this post

    If I decided to use my custom confirm dialog box instead of RadWindow, is there a way to programmatically invoke an item click?  I couldn't find anything in the documentation online.
  4. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 20 Mar 2008 Link to this post

    Hello Jacky Chau,

    Here is how to force a click on a RadMenu's item:

    function forceMenuItemClick() 
       { 
           var menu = $find("RadMenu1"); 
           var menuItem = menu.get_allItems()[0];             
           menuItem._click(); 
       }   

    Instead of get_allItems() method, you can also use findItemByText("MyItem") or findItemByAttribute, findItemByValue, findItemByUrl.



    Sincerely yours,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top