This is a migrated thread and some comments may be shown as answers.

Custom confirm on item clicking

3 Answers 107 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Jacky Chau
Top achievements
Rank 1
Jacky Chau asked on 15 Mar 2008, 06:06 PM
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?

3 Answers, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 18 Mar 2008, 11:32 AM
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
0
Jacky Chau
Top achievements
Rank 1
answered on 18 Mar 2008, 01:26 PM
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.
0
Georgi Tunev
Telerik team
answered on 20 Mar 2008, 01:02 PM
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
Tags
Menu
Asked by
Jacky Chau
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Jacky Chau
Top achievements
Rank 1
Georgi Tunev
Telerik team
Share this question
or