1. #51
    Sencha User
    Join Date
    Jul 2009
    Posts
    60
    Vote Rating
    1
    ImShogun is on a distinguished road

      0  

    Default Ext 4.1

    Ext 4.1


    Hi all,

    Special thanks to wm003 for this great Ext 3 plugin, and also thanks to Wojtekn for porting it to Ext 4,

    I tried both the original 1.2 and Ext 4 port without success under Ext 4.1, so here is the one I could successfully use:

    Regards!

    PHP Code:

    /*
      * Ext.ux.menu.StoreMenu  Addon
      *
      * @author    Marco Wienkoop (wm003/lubber)
      * @copyright (c) 2009, Marco Wienkoop (marco.wienkoop@lubber.de) http://www.lubber.de
      *
      * @class Ext.ux.menu.StoreMenu
      * @extends Ext.menu.Menu

    * Donations are always welcome :)
    * Any amount is greatly appreciated and will help to continue on developing ExtJS Widgets
    *
    * You can donate via PayPal to donate@lubber.de
    *
        This program is free software: you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation, either version 3 of the License, or
        (at your option) any later version.

        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.

        You should have received a copy of the GNU General Public License
        along with this program.  If not, see <http://www.gnu.org/licenses/>
        
     * This Addon requires the ExtJS Library, which is distributed under the terms of the GPL v3 (from V2.1)
     * See http://extjs.com/license for more info


    Revision History
    v 0.2 [2009/03/04]
    - added support for submenu ("menu" has to be delivered such as "handler")

    v 0.1 [2009/03/03]
    Initial release
    */

    /*
       Modified by Joe Kuan - kuan.joe@gmail.com
       Ported to Ext 4 by Wojciech Naruniec - w.naruniec@gmail.com
       13/06/2012: Ported to Ext 4.1 by Laurent Chenet - laurent.chenet@gmail.com (Tested only with parameter 'url')
    */

    Ext.namespace('Ext.ux.menu');
    Ext.define('Ext.ux.menu.StoreMenu', {
        
    extend'Ext.menu.Menu',    
        
    initComponent: function(){
            
    this.initConfig();        
            
    // call parent
            
    this.callParent(arguments);        
            
    // Keep track of what menu items have been added
            
    this.storeMenus = [];        
            if (
    this.itemsOffset === undefined) {
                
    this.itemsOffset 0;
            };        
            
    this.on('render'this.onMenuLoadthis);        
            if (!
    this.store) {
                
    //at least url/proxy or data need to be given in config when initiating this component
                
    this.store = new Ext.data.Store({
                    
    proxy:{
                        
    type:'ajax',
                        
    urlthis.url,
                        
    reader:{
                            
    type:'json'
                        
    }
                    },
                    
    fields: ['config'],                
                    
    baseParamsthis.baseParams
                
    });
            };        
            
    this.store.on('beforeload'this.onBeforeLoadthis);
            
    this.store.on('load'this.onLoadthis);
        },    
        
    loadingTextExt.LoadMask.prototype.msg || 'Loading...',
        
    loadedfalse,    
        
    onMenuLoad: function(){
            if (!
    this.loaded || this.autoReload) {
                
    this.store.load();
                
    XXX this.store;
            };
        },    
        
    updateMenuItems: function(loadedStaterecords){
            for (var 
    0this.storeMenus.lengthi++) {
                
    this.remove(this.storeMenus[i]);
            }
            
    this.storeMenus = [];        
            if (
    loadedState) {
                for (var 
    0len records.lengthleni++) {
                    
    //create a real function if a handler or menu is given as a string (because a function cannot really be encoded in JSON
                    
    if (records[i].raw.handler) {
                        eval(
    "records[i].raw.handler = " records[i].raw.handler);
                    }
                    else if (
    this.itemsHandler) {
                            
    records[i].raw.handler this.itemsHandler;
                    };            
                    if (
    records[i].raw.menu) {
                        eval(
    "records[i].raw.menu = " records[i].raw.menu);
                    };
                    
    this.storeMenus.push(this.insert(this.itemsOffset irecords[i].raw));
                }
            }
            else {
                
    this.storeMenus.push(this.insert(this.itemsOffset i'<span class="loading-indicator">' this.loadingText '</span>'));
            };    
            
    this.loaded loadedState;    
        },    
        
    onBeforeLoad: function(store){
            
    this.updateMenuItems(false);
        },    
        
    onLoad: function(storerecords){
            
    this.updateMenuItems(truerecords);
        },
        
    setItemsHandler: function(handler){
            
    this.itemsHandler handler;
        },    
        
    setOffset: function(offset){
            
    this.itemsOffset offset;
        },    
        
    setAutoReload: function(autoReload){
            
    this.autoReload autoReload;
        },    
        
    setBaseParam: function(paramvalue){
            
    this.store.setBaseParam(paramvalue);
        },    
        
    setStore: function(store){
            
    this.store store;
        }
    }); 
    The expected typical config of menu item is:

    PHP Code:

    {
               
    text'Grid Viewer',
               
    menu: new Ext.ux.menu.StoreMenu({
                        
    url'yoururl'
               
    })

    Example of json answer:

    PHP Code:

    [{"text":"Playground dummy node","iconCls":"light_bulb","handler":"function(item) {gridViewerObj.OpenGridViewTab(9999,'light_bulb',\"Playground dummy node\");}","id_node_type":9999},{"text":"Annual Programme for Delegation","iconCls":"folder","handler":"function(item) {gridViewerObj.OpenGridViewTab(1,'folder',\"Annual Programme for Delegation\");}","id_node_type":1},{"text":"Domain","iconCls":"topic","handler":"function(item) {gridViewerObj.OpenGridViewTab(2,'topic',\"Domain\");}","id_node_type":2},{"text":"Decentralized programme","iconCls":"mail_send","handler":"function(item) {gridViewerObj.OpenGridViewTab(15,'mail_send',\"Decentralized programme\");}","id_node_type":15},{"text":"Programme","iconCls":"note_book","handler":"function(item) {gridViewerObj.OpenGridViewTab(3,'note_book',\"Programme\");}","id_node_type":3},{"text":"Decision","iconCls":"light_bulb","handler":"function(item) {gridViewerObj.OpenGridViewTab(4,'light_bulb',\"Decision\");}","id_node_type":4},{"text":"Decentralized decision","iconCls":"light_bulb","handler":"function(item) {gridViewerObj.OpenGridViewTab(16,'light_bulb',\"Decentralized decision\");}","id_node_type":16},{"text":"Component","iconCls":"puzzle","handler":"function(item) {gridViewerObj.OpenGridViewTab(12,'puzzle',\"Component\");}","id_node_type":12},{"text":"Priority Axis","iconCls":"warning","handler":"function(item) {gridViewerObj.OpenGridViewTab(5,'warning',\"Priority Axis\");}","id_node_type":5},{"text":"Focal Area","iconCls":"search","handler":"function(item) {gridViewerObj.OpenGridViewTab(6,'search',\"Focal Area\");}","id_node_type":6},{"text":"Sector","iconCls":"search","handler":"function(item) {gridViewerObj.OpenGridViewTab(7,'search',\"Sector\");}","id_node_type":7},{"text":"Project","iconCls":"note","handler":"function(item) {gridViewerObj.OpenGridViewTab(8,'note',\"Project\");}","id_node_type":8},{"text":"Sub-Project","iconCls":"note_book","handler":"function(item) {gridViewerObj.OpenGridViewTab(13,'note_book',\"Sub-Project\");}","id_node_type":13},{"text":"Activity-Envelope","iconCls":"mail_send","handler":"function(item) {gridViewerObj.OpenGridViewTab(14,'mail_send',\"Activity-Envelope\");}","id_node_type":14},{"text":"Procurement","iconCls":"shopping_cart","handler":"function(item) {gridViewerObj.OpenGridViewTab(9,'shopping_cart',\"Procurement\");}","id_node_type":9},{"text":"Contract","iconCls":"edit_page","handler":"function(item) {gridViewerObj.OpenGridViewTab(10,'edit_page',\"Contract\");}","id_node_type":10},{"text":"Financial Memorandum","iconCls":"mail_send","handler":"function(item) {gridViewerObj.OpenGridViewTab(17,'mail_send',\"Financial Memorandum\");}","id_node_type":17},{"text":"Payment","iconCls":"euro_currency_sign","handler":"function(item) {gridViewerObj.OpenGridViewTab(11,'euro_currency_sign',\"Payment\");}","id_node_type":11},{"text":"Objectives","iconCls":"search","handler":"function(item) {gridViewerObj.OpenGridViewTab(18,'search',\"Objectives\");}","id_node_type":18},{"text":"Decentralized project","iconCls":"note","handler":"function(item) {gridViewerObj.OpenGridViewTab(19,'note',\"Decentralized project\");}","id_node_type":19},{"text":"Local contract","iconCls":"edit_page","handler":"function(item) {gridViewerObj.OpenGridViewTab(20,'edit_page',\"Local contract\");}","id_node_type":20},{"text":"Local payment","iconCls":"euro_currency_sign","handler":"function(item) {gridViewerObj.OpenGridViewTab(21,'euro_currency_sign',\"Local payment\");}","id_node_type":21}] 
    Last edited by ImShogun; 29 Jun 2012 at 5:50 AM. Reason: Fixing code
    all:true

  2. #52
    Sencha User luisparada's Avatar
    Join Date
    Nov 2007
    Location
    Venezuela
    Posts
    94
    Vote Rating
    2
    luisparada is on a distinguished road

      0  

    Default


    Is it possible to use it with extjs 4.1 ??? Is the posted code tested with it ??
    ____________________________________
    do not make install, just compile it.!!!
    --------------------------------------------------
    //*************k4m1k4z3************\\

  3. #53
    Sencha User
    Join Date
    Jul 2009
    Posts
    60
    Vote Rating
    1
    ImShogun is on a distinguished road

      0  

    Default @luisparada

    @luisparada


    Yes, it is working under 4.1. I edited my previous post with the methods I'm using. I also fixed the store type because I suspect my first release was not working properly without the compatibility layer (sorry for that)
    all:true

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi