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
    Sencha User
    Join Date
    Jun 2012
    Posts
    40
    Vote Rating
    0
    Gery is on a distinguished road

      0  

    Default replace protocol in geoext.form.formpanel‏‏

    replace protocol in geoext.form.formpanel‏‏


    Hi all,

    I've been scratching my head over this and I'm wondering if this is possible. I want to replace the protocol of the GeoExt.form.FormPanel in the following way:

    1. to render the formpanel, I defined a variable "proto" as null outside the formpanel (var proto = null).
    2. then "proto" goes inside the formpanel (protocol: proto).
    3. in the handler function of the button a new variable "proto" is defined. I want to replace this new variable inside the formpanel.

    Since extjs, geoext, openlayers are javascript libraries, I've tried things such as "eval" to make the variable "proto" inside the handler accessible in the formpanel but no luck so far. Here it is a simplified example to show this:

    Code:
    var proto = null;
    
    var formPanel = new GeoExt.form.FormPanel({
        protocol: proto,                # <--- replace with [1]
        items: [{
            xtype: "combo",
            id: "idcombo",
            etc...
        }, {
            xtype: "textfield",
            id: "idtext",
            etc...
        }],
        button:[{
            text: "search",
            handler: function() {
                formPanel.search();
                var combo = Ext.getCmp('idcombo').getValue();      # <--- this works and gets the value chosen in "xtype: combo"
                var proto: new OpenLayers.Protocol.HTTP({          # <--- [1] (ie. new variable "proto")
                    url: "http://www.pub.pub/" + combo + "/somestuff/",    # <--- this works
                    format: etc...
                })
            }
        }]
    })
    how could I do this? I'll appreciate your support, thanks in advance.

    Best regards,

    Gery

  2. #2
    Sencha User
    Join Date
    Jan 2011
    Posts
    544
    Vote Rating
    51
    willigogs is a jewel in the rough willigogs is a jewel in the rough willigogs is a jewel in the rough

      0  

    Default


    If I'm understanding the problem correctly, surely all you would need to do is:
    Code:
    var p = new OpenLayers.Protocol.HTTP({ //CONFIG HERE});
    formPanel.protocol = p;

  3. #3
    Sencha User
    Join Date
    Jun 2012
    Posts
    40
    Vote Rating
    0
    Gery is on a distinguished road

      0  

    Default


    Thank you willigogs for the idea, I tried it but I'm getting this error:

    Code:
    TypeError: o.protocol is null
    and it points to the SearchAction.js (line 122).

    I'm sure this is because
    Code:
    var proto = null;
    defined outside the formPanel. I read that SearchAction.js but don't get what is the problem to replace the protocol.

  4. #4
    Sencha User
    Join Date
    Jan 2011
    Posts
    544
    Vote Rating
    51
    willigogs is a jewel in the rough willigogs is a jewel in the rough willigogs is a jewel in the rough

      0  

    Default


    I have never used GeoExt, so I'm completely guessing here - but could the fact that you are calling formPanel.search() before populating the protocol be a problem?

  5. #5
    Sencha User
    Join Date
    Jun 2012
    Posts
    40
    Vote Rating
    0
    Gery is on a distinguished road

      0  

    Default


    yeah in fact that could be the problem, how could I solve that? in the handler putting formPanel.search() after var proto doesn't solve the problem btw
    Last edited by Gery; 15 Jan 2013 at 10:09 AM. Reason: http://www.sencha.com/forum/newreply.php?p=929518&noquote=1

  6. #6
    Sencha User
    Join Date
    Jan 2011
    Posts
    544
    Vote Rating
    51
    willigogs is a jewel in the rough willigogs is a jewel in the rough willigogs is a jewel in the rough

      0  

    Default


    I would recommend some basic debugging to see what is / is not getting set.

    Something like:
    Code:
    button:[{
    	text: "search",
    	handler: function() {
    	    
    	    console.log(formPanel)
    	    console.log(formPanel.protocol)
    	    
    	    var combo = Ext.getCmp('idcombo').getValue();
    	    var proto = new OpenLayers.Protocol.HTTP({
    	        url: "http://www.pub.pub/" + combo + "/somestuff/"
    	    });
    	    
    	    formPanel.protocol = proto;
    	    console.log(formPanel.protocol)
    	    	
    	    formPanel.search();
    	    
    	}
    }]
    If everything is being set as expected, but the formPanel.search() function is still failing, then double check that this is successful if hardcoded into the protocol to begin with.

    The only other option I would investigate before searching for someone with specific GeoExt assistance, would be to see if destroying and re-instantiating the form (with the correct protocol assigned) would be a possibility.

  7. #7
    Sencha User
    Join Date
    Jun 2012
    Posts
    40
    Vote Rating
    0
    Gery is on a distinguished road

      0  

    Default


    I tested your suggestion and this is the result:

    Code:
    this is formPanel: [object Object]
    
    this is 1st formPanel.protocol: null
    
    this is 2nd formPanel: [object Object]
    
    TypeError: o.protocol is null
    so I think it's clear that the formPanel.protocol = proto; is sending nothing to the formPanel because the proto there is still null (as it was set at the beginnig).

    Your second option sounds interesting, the thing is if I destroy the form it dissapears after pressing the search button and don't know well how to re-instantiating it . This form is inside an Ext.Window btw. Let me post my code and see how can I do that please:

    Code:
    var proto = null;
                  var formPanel = new GeoExt.form.FormPanel({
                    protocol: proto,
                    items: [{
                      xtype: 'combo',
                      id: 'idcombo',
                      store: new Ext.data.SimpleStore({
                        fields: ['idlayer','layer'],
                        data: [["1","cars"],["2","music"],["3","food"],["4","girls"]]
                      }),
                      displayField: 'layer',
                      valueField: 'idlayer',
                      fieldLabel: 'Layer',
                      emptyText: 'select a layer',
                      submitValue: false,
                      selectOnFocus: true,
                      mode: 'local',
                      typeAhead: true,
                      editable: false,
                      forceSelection: true,
                      triggerAction: 'all'
                    },{
                      xtype: 'textfield',
                      id: 'idtextfield',
                      fieldLabel: 'Keyword',
                      emptyText: 'enter keyword',
                      name: 'comments__like',
                      allowBlank: false
                    }],
                    listeners: {
                      actioncomplete: function(form, action) {}
                    },
                    buttons: [{
                      text: 'search',
                      handler: function(){                 
                        console.log('this is formPanel: ' + formPanel);
                        console.log('this is 1st formPanel.protocol: ' + formPanel.protocol);
    
                        var comboLayer = Ext.getCmp('idcombo').getRawValue();
                        var keyword = Ext.getCmp('idtextfield').getRawValue();
                        var proto = new OpenLayers.Protocol.HTTP({
                            url: 'http://www.pub.pub/' + comboLayer + 'comments__ilike=' + keyword + '&queryable=comments',
                            format: new OpenLayers.Format.GeoJSON()
                        });
    
                        formPanel.protocol = proto;
                        console.log('this is 2nd formPanel: ' + formPanel.protocol);
    
                        formPanel.destroy();
                        formPanel.search();
                        
                      }
                    }],
                    keys:
                    [{
                      key: [
                        Ext.EventObject.ENTER
                      ],
                      handler: function(){
                        formPanel.search();
                      }
                    }]
                  });

  8. #8
    Sencha User
    Join Date
    Jan 2011
    Posts
    544
    Vote Rating
    51
    willigogs is a jewel in the rough willigogs is a jewel in the rough willigogs is a jewel in the rough

      0  

    Default


    On the contrary, the above debugging proves that the protocol IS being set successfully (the 3rd console.log was of the protocol, not the formPanel).

    I would recommend you use Firefox, then install Firebug and illuminations. Debugging and only being returned "Object" or "Null" makes things near impossible to debug easily.

    https://getfirebug.com/
    http://www.illuminations-for-developers.com/

    These will then allow you to console.log() objects, and then click what is returned to view the object's config and inspect the DOM.

  9. #9
    Sencha User
    Join Date
    Jun 2012
    Posts
    40
    Vote Rating
    0
    Gery is on a distinguished road

      0  

    Default


    Hi Willigogs

    sorry for my late answer to your last message. After checking with illuminations (because firebug is already installed), I noticed that the new searchformPanel.protocol (3rd console.log you refered) works well as you pointed out, but it's not being sent back to the searchformPanel, or at least is not read by it. With illuminations I went to the SearchAction.js (line 122) (the error in firebug) and pointing with the cursor to that line I saw that protocol is still null (o.protocol.read), here I show you the part of the SearchForm.js:

    Code:
    110 /** private: method[run]
    111 * Run the action.
    112 */
    113 run: function() {
    114 var o = this.options;
    115 var f = GeoExt.form.toFilter(this.form, o.logicalOp, o.wildcard);
    116 if(o.clientValidation === false || this.form.isValid()){
    117
    118 if (o.abortPrevious && this.form.prevResponse) {
    119 o.protocol.abort(this.form.prevResponse);
    120 }
    121
    122 this.form.prevResponse = o.protocol.read(
    123 Ext.applyIf({
    124 filter: f,
    125 callback: this.handleResponse,
    126 scope: this
    127 }, o)
    128 );
    129 } else if(o.clientValidation !== false){
    130 // client validation failed
    131 this.failureType = Ext.form.Action.CLIENT_INVALID;
    132 this.form.afterAction(this, false);
    133 }
    134 },
    In line 122 (o.protocol.read), if I put the cursor over only the "o", illuminations says "Object { abortPrevious=true, protocol=null }". If I move it over "protocol", it says "null".

    I was wondering if the problem is because line 122 is inside a "private" method as appears in line 110, what do you think?

    Thank you,

  10. #10
    Sencha User
    Join Date
    Jun 2012
    Posts
    40
    Vote Rating
    0
    Gery is on a distinguished road

      0  

    Default


    I did a cleaner post about this, please check here: http://www.sencha.com/forum/showthre....HTTP&p=935193

Thread Participants: 1

Tags for this Thread