jqueryajaxkendo-uimenukendo-menu

kendo menu ui on open create submenu


I'm trying to create the submenu thru an ajax call sending the parent element as a parameter to get the submenu items on the open event but is not working.

Has anyone have an idea how this can be done?

Thanks


Solution

  • You can utilize the append method like

    menu.append({text: submenu}, parentMenu);
    

    where

    1. parentMenu > is the target where you wanted to append, we need to pass this as param from select event
    2. submenu > is the sub menu text/string

    i tried it myself, here is the example

    a bit of explanation of the example :

    1. get the e.item and store/pass it to the function and will be used later as target where we wanted to append
    2. do the ajax call then after you got the response, just do looping through the submenu and add it to the parent menu

    ps : there is still 1 issue if you select the menu twice it will append the submenu twice, you need to handle this issue