extjs - GeoExt: Change Filter via changing field name -


in geoext 2, have form 1 field , 2 radio buttons. coded radio buttons change name of field correspond convention of geoext.

items: [     {         xtype: "numberfield",         itemid: 'parcel',         name: 'parcelatt__ge',         fieldlabel: 'parcel number:'     },     {         xtype: 'radiogroup',         fieldlabel: 'search type:',         columns: 2,         vertical:true,         items: [             {                 boxlabel: 'greater than',                 name: 'option',                 inputvalue: '1',                 submitvalue: false,                 checked: true,                 listeners: {                     change: function (field, newvalue, oldvalue) {                         if (newvalue) mypanel.down('#parcel').inputel.dom.name = 'parcelatt__ge';                     }                 }             },             {                 boxlabel: 'lower then',                 name: 'option',                 inputvalue: '2',                 submitvalue: false,                 listeners: {                     change: function (field, newvalue, oldvalue) {                         if (newvalue) mypanel.down('#parcel').inputel.dom.name = 'parcelatt__le';                     }                 }             },         ]     } ], 

i can confirm (via firebug) above code changes field name in html, when submitting form, geoext not use new field name in setting openlayers filter.

any hint or solution?

unless have file upload field in form, extjs not use html form submission @ all, input element's name not used.

two possible solutions:

either can try whether can use setname function on field:

mypanel.down('#parcel').setname('parcelatt__le') 

or have use 2 fields predefined names, , synchronize values between them:

items: [{     xtype: "numberfield",     itemid: 'parcelge',     name: 'parcelatt__ge',     fieldlabel: 'parcel number:' },{     xtype: "numberfield",     hidden: true,     itemid: 'parcelle',     name: 'parcelatt__le',     fieldlabel: 'parcel number:' },{     xtype: 'radiogroup',     fieldlabel: 'search type:',     columns: 2,     vertical:true,     simplevalue: true,     items: [{         boxlabel: 'greater than',         name: 'option',         inputvalue: 'ge',         submitvalue: false,         checked: true     },{         boxlabel: 'lower than',         name: 'option',         inputvalue: 'le',         submitvalue: false     }],     listeners: {         change: function (field, newvalue, oldvalue) {             var lefield = mypanel.query('#parcelle'),                 gefield = mypanel.query('#parcelge');             if(newvalue=='le') {                 lefield.show();                 gefield.hide();                 lefield.setvalue(gefield.getvalue());             }             else if(newvalue=='ge') {                 gefield.show();                 lefield.hide();                 gefield.setvalue(lefield.getvalue());             }         }     } }], 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -