Premium forums

Framework for dispatching an action for a menu item selection ?

  • RichardAD
    RichardAD avatar

    02 Apr 2012 (Link to this post)

    In general I guess I am asking what are people doing in the select: method.

    I would like some feedback on the following

    <ul id='myMenu'>
    <li data-handler='miItem1;'> item 1 </li>
    <li data-handler='alert("!")> item 2 </li>
    </ul>

    and
    $('#myMenu').kendoMenu({
      select:
    function (e) {
       
    var handler;
       
    if (handler = $(e.item).data('handler')) {
          Function (handler)();  /* construct and execute handler */
        }
      }
    });

    function miItem1() {
      alert('menu Item 1');
    }

    Thanks,

    Richard

Read FAQ or see Kendo UI in action!

Launch Demos