ExtJS Desktop association level two menu desktop shortcuts

Source: Internet
Author: User

Recently in the use of ExtJS to do the system, ready to ExtJS desktop on the basis of the transformation, because the official example only a level menu, for the two-level menu calls there is no way, so want to click on the desktop shortcut icon can also open the window of the words need to find another way.

After viewing the source code, found that it is not very difficult, want to achieve the goal only need to modify the ExtJS desktop with examples of two JS file can, paste code, welcome correction:

App.js

Getmodule:function (name) {var ms = This.modules; for (var i = 0, len = ms.length; i < Len; i++) {if (Ms[i].id = name | | Ms[i].apptype = = name) {return ms[i];} else {if (ext.isdefined (ms[i].launcher.menu) = = True && ms[i].launcher.men U.items.length > 0) {for (var j = 0, lens = ms[i].launcher.menu.items.length J < lens; J +) {if (ms[i].launcher.me Nu.items[j].id = = name) {return ms[i].launcher.menu.items[j];}} }} return '; }

Desktop.js

if (shortcuts) {shortcuts.on (' click ', function (E, t) {if (t = e.gettarget (' dt ', shortcuts)) {e.stopevent (); var module = App . GetModule (T.id.replace ('-shortcut ', ')); if (module) {if (ext.isdefined (module.itemid) = False) {Module.createwindow ();} else {var str = t.id.replace ('-shortcut ') , ''); var strleft = str.substring (0,str.indexof ("-")); var strright = str.substring (Str.indexof ("-") +1); var strlefts = strleft.substring (0,1). toUpperCase () +strleft.substring (1); var strrights = strright.substring (0,1). toUpperCase () +strright.substring (1); var fun = "Create". Concat (Strlefts). Concat (strrights). Concat ("window ()"); Eval ("Module.scope.") + fun); } } } }); }

[For example, the menu ID is menu-query, then the method to create the window is Createmenuquerywindow, so that's OK]

Additionally, in the JS file on the page side, you need to configure the ItemId property

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.