Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Ext User
    Join Date
    Jan 2008
    Posts
    7
    Vote Rating
    0
    tuxhero is on a distinguished road

      0  

    Default Passing Params to directFn

    Passing Params to directFn


    I was trying to pass params to my directFn function in Ext.data.DataStores but none of the way is working. By looking at source i found API Docs and source does not match. Can some one help me out.

    My Source
    Code:
    new Ext.data.DirectStore({
    	storeId:'plugin-man',
    	paramsAsHash:false,
    	autoLoad:true,
    	directFn:Ext.ss.forge_configManager.read_details,
    	paramOrder:'interfaceMan_pluginDetails',
    	fields:['pluginName','pluginDescription','pluginPid','pluginModule','startup','startTime','stopTime','status']
    })
    ext-all-debug.js
    Code:
    Ext.data.DirectProxy = function(config){
    
        if(typeof this.paramOrder == 'string'){
            this.paramOrder = this.paramOrder.split(/[\s,|]/);
        }
        Ext.data.DirectProxy.superclass.constructor.call(this, config);
    };
    
    Ext.extend(Ext.data.DirectProxy, Ext.data.DataProxy, {
        
        paramOrder: undefined,
    
        
        paramsAsHash: true,
    
        
        directFn : undefined,
    
        // protected
        doRequest : function(action, rs, params, reader, callback, scope, options) {
            var args = [];
    
            var directFn = this.api[action] || this.directFn;
            switch (action) {
                case Ext.data.Api.CREATE:
                    args.push(params[reader.meta.root]);		// <-- create(Hash)
                    break;
                case Ext.data.Api.READ:
                    if(this.paramOrder){
                        for(var i = 0, len = this.paramOrder.length; i < len; i++){
                            args.push(params[this.paramOrder[i]]);
                        }
                    }else if(this.paramsAsHash){
                        args.push(params);
                    }
                    break;
                case Ext.data.Api.UPDATE:
                    args.push(params[reader.meta.idProperty]);  // <-- save(Integer/Integer[], Hash/Hash[])
                    args.push(params[reader.meta.root]);
                    break;
                case Ext.data.Api.DESTROY:
                    args.push(params[reader.meta.root]);        // <-- destroy(Int/Int[])
                    break;
            }
            args.push(this.createCallback(action, reader, callback, scope, options));
            directFn.apply(window, args);
        },
    
        // private
        createCallback : function(action, reader, callback, scope, arg) {
            return {
                callback: (action == Ext.data.Api.READ) ? function(result, e){
                    if (!e.status) {
                        this.fireEvent(action+"exception", this, e, result);
                        callback.call(scope, null, arg, false);
                        return;
                    }
                    var records;
                    try {
                        records = reader.readRecords(result);
                    }
                    catch (ex) {
                        this.fireEvent("writeexception", this, action, e, result, ex);
                        callback.call(scope, null, arg, false);
                        return;
                    }
                    this.fireEvent("write", this, action, e, arg);
                    callback.call(scope, records, arg, true);
                } : function(result, e){
                    if(!e.status){
                        this.fireEvent("writeexception", this, action, e);
                        callback.call(scope, null, e, false);
                        return;
                    }
                    this.fireEvent("write", this, action, result, e, arg);
                    callback.call(scope, result, e, true);
                },
                scope: this
            }
        }
    });
    Docs Source
    Code:
    /**
     * @class Ext.data.DirectProxy
     * @extends Ext.data.DataProxy
     */
    Ext.data.DirectProxy = function(config){
        Ext.apply(this, config);
        if(typeof this.paramOrder == 'string'){
            this.paramOrder = this.paramOrder.split(/[\s,|]/);
        }
        Ext.data.DirectProxy.superclass.constructor.call(this);
    };
    
    Ext.extend(Ext.data.DirectProxy, Ext.data.DataProxy, {
            
    /**
             * @cfg {Array/String} paramOrder Defaults to undefined. A list of params to be executed
             * server side.  Specify the params in the order in which they must be executed on the server-side
             * as either (1) an Array of String values, or (2) a String of params delimited by either whitespace,
             * comma, or pipe. For example,
             * any of the following would be acceptable:
    
    
    paramOrder: ['param1','param2','param3']
    paramOrder: 'param1 param2 param3'
    paramOrder: 'param1,param2,param3'
    paramOrder: 'param1|param2|param'
             
    
    
             */
            paramOrder: undefined,
    
            
    /**
             * @cfg {Boolean} paramsAsHash
             * Send parameters as a collection of named arguments (defaults to true). Providing a
             * {@link #paramOrder} nullifies this configuration.
             */
            paramsAsHash: true,
    
            // protected
            doRequest : function(action, rs, params, reader, writer, cb, scope, options) {
                    var args = [];
                    var directFn = this.api[action];
                    switch (action) {
                            case 'save':
                                    args.push(params[reader.meta.idProperty]);      // <-- save(Integer/Integer[], Hash/Hash[])
                                    args.push(params[writer.dataProperty]);
                                    break;
                            case 'destroy':
                                    args.push(params[writer.dataProperty]);         // <-- destroy(Int/Int[])
                                    break;
                            case 'create':
                                    args.push(params[writer.dataProperty]);         // <-- create(Hash)
                                    break;
                            case 'load':
                                    args.push(params);                                                      // <-- load(Hash)
                                    break;
                    }
                    args.push(this.createCallback(action, reader, cb, scope, options));
                    directFn.apply(window, args);
            },
    
            // private
            createCallback : function(action, reader, cb, scope, arg) {
                    return {
                            callback: (action == 'load') ? function(result, e){
                                    if (!e.status) {
                                            this.fireEvent(action+"exception", this, e, result);
                                            cb.call(scope, null, arg, false);
                                            return;
                                    }
                                    var records;
                                    try {
                                            records = reader.readRecords(result);
                                    }
                                    catch (ex) {
                                            this.fireEvent(action+"exception", this, e, result, ex);
                                            cb.call(scope, null, arg, false);
                                            return;
                                    }
                                    this.fireEvent(action, this, e, arg);
                                    cb.call(scope, records, arg, true);
                            } : function(result, e){
                                    if(!e.status){
                                            this.fireEvent(action+"exception", this, e);
                                    cb.call(scope, null, e, false);
                                    return;
                                    }
                            this.fireEvent(action, this, result, e, arg);
                            cb.call(scope, result, e, true);
                            },
                            scope: this
                    }
            }
    });

  2. #2
    Sencha User
    Join Date
    Apr 2009
    Location
    Bulgaria
    Posts
    21
    Vote Rating
    1
    ficeto is on a distinguished road

      1  

    Default


    in both cases it will not work.
    here is what works:
    Code:
              var myStore = new Ext.data.DirectStore({
    		root:'data',
    		totalProperty:'rows',
    		idProperty:'id',
    	        autoLoad:true,
    		remoteSort:true,
    	        fields: fields,
    		baseParams:{start:0,limit:20,sort:'id',dir:'ASC'},
    		api:{
    			load: function(params, proxy){
    				//console.log(params);//{start:0,limit:20,sort:'id',dir:'ASC'}
    				MyDirectFunction.method(params,function(provider, response){
    					//process response
    				});
    			}
    		}
    	});
    this is the only way i found to be able to pass arguments to a Direct function. It's actually one parameter that is an array of all parameters. (works great for me)

  3. #3
    Ext JS Premium Member dj's Avatar
    Join Date
    Mar 2007
    Location
    Germany
    Posts
    573
    Vote Rating
    2
    dj has a spectacular aura about dj has a spectacular aura about dj has a spectacular aura about

      0  

    Default


    Ext.data.Store#baseParams / Ext.data.Store#setBaseParam works for me:
    Code:
              var myStore = new Ext.data.DirectStore({
    		root:'data',
    		totalProperty:'rows',
    		idProperty:'id',
    	        autoLoad:true,
    		remoteSort:true,
    	        fields: fields,
    		baseParams:{start:0,limit:20,sort:'id',dir:'ASC', any:'param', you:'want', goes:'here'},
    		directFn:Ext.ss.forge_configManager.read_details
    	});
    or
    Code:
              var myStore = new Ext.data.DirectStore({
    		root:'data',
    		totalProperty:'rows',
    		idProperty:'id',
    		remoteSort:true,
    	        fields: fields,
    		baseParams:{start:0,limit:20,sort:'id',dir:'ASC'},
    		directFn:Ext.ss.forge_configManager.read_details
    	});
            myStore.setBaseParam('custom_param', 'value');
            myStore.reload();
    adding params to the load call works, too:
    Code:
              var myStore = new Ext.data.DirectStore({
    		root:'data',
    		totalProperty:'rows',
    		idProperty:'id',
    		remoteSort:true,
    	        fields: fields,
    		directFn:Ext.ss.forge_configManager.read_details
    	});
            myStore.setBaseParam('custom_param', 'value');
            myStore.load({
                    params: {start:0,limit:20,sort:'id',dir:'ASC'}
            });
    Daniel Jagszent
    dɐɳiel@ʝɐgszeɳt.de <- convert to plain ASCII to get my email address

  4. #4
    Ext User
    Join Date
    Jun 2009
    Posts
    10
    Vote Rating
    0
    dweller is on a distinguished road

      0  

    Default


    Quote Originally Posted by dj View Post
    Ext.data.Store#baseParams / Ext.data.Store#setBaseParam works for me:
    Code:
              var myStore = new Ext.data.DirectStore({
            root:'data',
            totalProperty:'rows',
            idProperty:'id',
                autoLoad:true,
            remoteSort:true,
                fields: fields,
            baseParams:{start:0,limit:20,sort:'id',dir:'ASC', any:'param', you:'want', goes:'here'},
            directFn:Ext.ss.forge_configManager.read_details
        });
    or
    Code:
              var myStore = new Ext.data.DirectStore({
            root:'data',
            totalProperty:'rows',
            idProperty:'id',
            remoteSort:true,
                fields: fields,
            baseParams:{start:0,limit:20,sort:'id',dir:'ASC'},
            directFn:Ext.ss.forge_configManager.read_details
        });
            myStore.setBaseParam('custom_param', 'value');
            myStore.reload();
    adding params to the load call works, too:
    Code:
              var myStore = new Ext.data.DirectStore({
            root:'data',
            totalProperty:'rows',
            idProperty:'id',
            remoteSort:true,
                fields: fields,
            directFn:Ext.ss.forge_configManager.read_details
        });
            myStore.setBaseParam('custom_param', 'value');
            myStore.load({
                    params: {start:0,limit:20,sort:'id',dir:'ASC'}
            });

    can you tell me the server side code.I can't found method to receive parameter.
    thanks

  5. #5
    Ext JS Premium Member dj's Avatar
    Join Date
    Mar 2007
    Location
    Germany
    Posts
    573
    Vote Rating
    2
    dj has a spectacular aura about dj has a spectacular aura about dj has a spectacular aura about

      0  

    Default


    What server-side are you using? Which Ext.Direct library?

    Basically the params are part of the data hash that gets sent to the server:
    Code:
    {"action":"TheAction","method":"TheMethod","data":[{"start":0,"limit":20,"sort":'id',"dir":'ASC', "any":'param', "you":'want', "goes":'here'}],"type":"rpc","tid":2}
    Daniel Jagszent
    dɐɳiel@ʝɐgszeɳt.de <- convert to plain ASCII to get my email address

  6. #6
    Ext User
    Join Date
    Jun 2009
    Posts
    10
    Vote Rating
    0
    dweller is on a distinguished road

      0  

    Default


    Quote Originally Posted by dj View Post
    What server-side are you using? Which Ext.Direct library?

    Basically the params are part of the data hash that gets sent to the server:
    Code:
    {"action":"TheAction","method":"TheMethod","data":[{"start":0,"limit":20,"sort":'id',"dir":'ASC', "any":'param', "you":'want', "goes":'here'}],"type":"rpc","tid":2}
    we use DirectJNgine as server-side .
    Now I get answer:DirectJNgine1.0 not support dynamic parameter.

    thanks

  7. #7
    Ext JS Premium Member dj's Avatar
    Join Date
    Mar 2007
    Location
    Germany
    Posts
    573
    Vote Rating
    2
    dj has a spectacular aura about dj has a spectacular aura about dj has a spectacular aura about

      0  

    Default


    Hi dweller,

    this seems to be (a) a problem with your server-side library or (b) a misconfiguration of the server-side library. Any ways, http://extjs.com/forum/showthread.php?t=73027 is the right place to ask. Make sure that you include some more code of you problem or even an example and I'm sure they can help you out.
    Daniel Jagszent
    dɐɳiel@ʝɐgszeɳt.de <- convert to plain ASCII to get my email address

  8. #8
    Ext JS Premium Member
    Join Date
    May 2009
    Location
    Barcelona (Spain)
    Posts
    218
    Vote Rating
    19
    pagullo will become famous soon enough pagullo will become famous soon enough

      0  

    Default


    Quote Originally Posted by dweller View Post
    we use DirectJNgine as server-side .
    Now I get answer:DirectJNgine1.0 not support dynamic parameter.

    thanks
    Hi.

    Definitely, dynamic params can be handled by DirectJNgine. You need to use a feature of DirectJNgine 1.0 final (but not RC1, which I think is what you were using at the time), that allows you to handle requests by using a JSON handling method, which will receive a JsonArray with the request data.

    In a dynamic parameters scenario, you need to handle the data at a lower level because there is no way DJN can know the right data types to instantiate if you ever receive a complex object as a dynamic parameter.

    Take a look at the Handling JSON data directly chapter in the User's Guide for additional info.

    If you have more questions about this issue, just post them in the main DirectJNgine thread, please.

    Regards,

    Pedro

  9. #9
    Sencha Premium Member
    Join Date
    Jan 2012
    Location
    Lahore
    Posts
    53
    Vote Rating
    -1
    waqar is an unknown quantity at this point

      0  

    Default


    @dweller

    Are you using ExtJs4 , if yes then does the DJN1.0 supports ExtJs 4 ?
    is your problem solved, which technique did you finally used to get through for passing parameters to from Direct store to Java method.

    please share ..



    Quote Originally Posted by dweller View Post
    we use DirectJNgine as server-side .
    Now I get answer:DirectJNgine1.0 not support dynamic parameter.

    thanks