1. #1
    Sencha User
    Join Date
    Aug 2010
    Posts
    17
    Vote Rating
    0
    umenokin is an unknown quantity at this point

      0  

    Default New StoreMenu plugin

    New StoreMenu plugin


    Populate menu with items from store

    Code:
    /**
     * Extend Ext menu class to automatically load and generate menu items from storage
     */
    Ext.define('Ext.ux.menu.StoreMenu', {
        extend: 'Ext.menu.Menu',
        alias: ['widget.storemenu'],
        requires: ['Ext.Action'],
    
    
        config: {
            displayField: 'text',
            loadingText: 'Loading...',
            loaded: false,
            store: null,
    
    
            itemGenerationHandler: function(menu, record) {
                var action = Ext.create('Ext.menu.Item', {
                    record: record,
                    text: record.get(menu.getDisplayField()),
                    valueField: record.getId()
                });
    
    
                return action;
            }
        },
    
    
        initComponent: function() {
            this.initConfig();
            // call parent
            this.callParent(arguments);
    
    
            if(!this.getStore()) {
                this.setStore(new Ext.data.Store({
                    proxy:{
                        type:'ajax',
                        url: this.url,
                        reader:{
                            type:'json'
                        }
                    },
                    fields: ['id', 'name'],
                    baseParams: this.baseParams
                }));
            };
    
    
            this.on('render', this.onMenuLoad, this);
            this.getStore().on('beforeload', this.onBeforeStoreLoad, this);
            this.getStore().on('load', this.onStoreLoad, this);
        },
    
    
        /**
         * Load store when load menu.
         */
        onMenuLoad: function() {
            if (!this.getLoaded()) {
                this.getStore().load();
            };
        },
    
    
        /**
         * Generate menu items.
         * @param loadedState
         * @param records
         */
        updateMenuItems: function(loadedState, records) {
            this.removeAll();
    
    
            // This div taken from Mask, so they use same styles
            if(!loadedState) {
                this.add('<div class="x-mask-msg-inner"><div class="x-mask-msg-text">Please wait...</div></div>');
                return;
            }
    
    
            this.removeAll();
    
    
            Ext.each(records, function(r) {
                this.add(this.itemGenerationHandler(this, r));
            }, this);
    
    
            this.setLoaded(loadedState);
        },
    
    
        /**
         * Store before load event handler. Before storage was loaded show one item with mask
         */
        onBeforeStoreLoad: function() {
            this.updateMenuItems(false);
        },
    
    
        /**
         * Store load event handler. Populate menu items after storage was loaded
         * @param store
         * @param records
         */
        onStoreLoad: function(store, records){
            this.updateMenuItems(true, records);
        }
    });

  2. #2
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    4,770
    Vote Rating
    165
    slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold

      0  

    Default


    Nice! Thanks for sharing!
    Are you a Sencha products veteran who has wondered what it might be like to work at Sencha? If so, please reach out to our recruiting manager: sheryl@sencha.com

    C
    heck out all of the 2013 SenchaCon presentations here:
    http://www.sencha.com/blog/senchacon...now-available/

  3. #3
    Sencha User
    Join Date
    Jan 2014
    Posts
    18
    Vote Rating
    2
    AkshayKalbhor is on a distinguished road

      1  

    Default


    Hi,Can you please provide some link/screenshot for checking the out the output instantly?

Thread Participants: 2

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar