1. #1
    Ext JS Premium Member
    Join Date
    Jan 2008
    Posts
    123
    Vote Rating
    0
    BuckBazooka is on a distinguished road

      0  

    Default ExtDesigner with custom store

    Hi,
    I am using ExtDesigner. I want to create a store, which is using a url given by a variable. Not statically entered in the tool. Also I need to specify some extra parameters before the call to load is sent. With normal js it is easy. But what is the approach to solve these problems when we use ExtDesigner? The js containing the store defined by the designer is generated each time one export the data, so it is not the right place to edit. How should I solve these problems?

    Any suggestions? Again, thanks for your advice.

  2. #2
    Sencha User aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,487
    Vote Rating
    140
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default

    In the latest release (1.0.0.8), all stores accept a configuration which will overwrite the default configs. You can create instances of your store type in the implementation classes and provide custom urls etc.

    Perhaps we should add an option in the store tab, "Create instance of this store" which would create the instance in the code gen.
    Aaron Conran
    @aconran

  3. #3
    Ext JS Premium Member
    Join Date
    Jan 2008
    Posts
    123
    Vote Rating
    0
    BuckBazooka is on a distinguished road

      0  

    Default

    Thanks again Aaron for your reply.

    I'm not sure to understand completely what you mean. I use now the cfg when I call the constructor to overwrite the defaults which I need to set. But I still have one remaining problem.

    In MyStoreClass.js file the designer instantiates the store. In my case the store should not be instantiated as soon as the javascripts are loaded, as I will need to instantiate this store only once I know more details about what the user wants to do.

    Code:
    ...
     * This file will be auto-generated each and everytime you export.
     *
     * Do NOT hand edit this file.
     */
    
    FreePriceElementStore = Ext.extend(Ext.data.JsonStore, {
        constructor: function(cfg) {
            cfg = cfg || {};
            FreePriceElementStore.superclass.constructor.call(this, Ext.apply({
                storeId: 'FreePriceElementStore',
                idProperty: 'id',
                sortField: 'country',
                autoLoad: true,
                remoteSort: true,
                sortDir: 'ASC',
                root: 'results',
                fields : [
                {
                    name: 'country',
                    mapping: 'priceComponent.country'
                },
                {
                    name: 'modificationDate',
                    dateFormat: 'd/m/Y H:i:s',
                    type: 'date'
                },
                {
                    name: 'id'
                },
                {
                    name: 'priceComponent'
                }
            ]
            }, cfg));
        }
    });
    new FreePriceElementStore();        // <<<<<<<< I need to remove this.
    I instantiate this class in my code like this:
    Code:
    FreeElementsWindow = Ext.extend(FreeElementsWindowUi, {
        initComponent: function() {
    	new FreePriceElementStore({
    		url:zenurl.salesadmin_getContractFreeElementRecords,
                    autoDestroy:true,
    		listeners:{
    			beforeload: function(store, options){
    				options.params["contract.id"] = this.contract.id;
    			},
    			scope:this
    		}
    	});
    	
            FreeElementsWindow.superclass.initComponent.call(this);
            this.addFreeElementsBtn.on("click", this.onAddFreeElementsBtn, this);
        },
        onAddFreeElementsBtn: function(){
        	console.log("onAddFreeElementsBtn");
        },
        ....
    I think for me the current implementation of the designer would be fine if I could tell it not to instantiate the store. I can only instantiate this store once I know which contract the user selected. Once I know this I can show the grid and instantiate the store with the proper parameters to be sent. Do I make sense? Thanks

  4. #4
    Sencha User aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,487
    Vote Rating
    140
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default

    Yes, this makes sense and we will add this as an option.
    Aaron Conran
    @aconran

  5. #5
    Ext JS Premium Member
    Join Date
    Jan 2008
    Posts
    123
    Vote Rating
    0
    BuckBazooka is on a distinguished road

      0  

    Default

    Great Thanks.

Thread Participants: 1