switch the selector on the fly

Subscribe to switch the selector on the fly 3 post(s), 2 voice(s)

 
Avatar John Carlson 18 post(s)

Hey is there a way to switch the selector for the menu on the fly.. say I create a menu, but i want to use it on a table of data and I want to switch the selector so that I can tell it which say row id I am on to respond to my menu actions..

 
Avatar kangax Administrator 3 post(s)

John, you could always create another instance of a menu which would be binded to another selector. I am planning to change selector logic in a near future to use delegation, rather than attaching events directly. This would make it possible to add/remove elements from the document without worrying about losing event handlers.

Best,
kangax

 
Avatar John Carlson 18 post(s)

Hey man… well I don’t want to make another instance.. because if I show a datagrid with like say 20 rows I would have to make 20 menus….. and that can’t be good.. :( so that is why I ask if you can make one menu that when you click on a row it changes the selector or sends a variable to the menu for the call backs.. so if I click on row 1 it sends say 1 to the alert(row) and it would show row1.. in the alert.. :)

thanks for the quick reply