javascript - modified code is not correct for the getvalue and setvalue -
- my code working fine wanted change code....
- they wanted attach setvalue , getvalue added directly footballpanel instead of sports grid,
- but after adding code not working fine...
- can guys tell me why not working....
- providing modified code below...
- the ui action here performing there 2 radio buttons, when click each radio button 2 different grids open
- in 1 of grid add value, when switch radio button values in grid disappears should not disappear...
- after modified code values disappear, can tell me why
only part of modified code here
else { this.setdisabled(true); this.addcls("sports-item-disabled"); if (sportsgrid.store.getcount() > 0) { var footballpanel = sportsgrid.up('panel'); footballpanel.holdvalue = footballpanel.getvalue(); footballpanel.setvalue(); sportsgrid.addcls("sports-item-disabled"); } }
whole modified code:
sportscontainerhandler: function(radiogroup, newvalue, oldvalue, options) { var sportscustomparams = options.sportscustomparams; var uipage = this.up('football-ux-sports-ui-page'); var sportsdefinition = metamodelshelper.getsportsdefinition( uipage, sportscustomparams.sportshandlerdefinitionid); var sportsfieldparam = sportsdefinition.params['sportsmultifieldname']; var sportsgrid = uipage.querybyid(sportsfieldparam.defaultvalue).grid; if (newvalue[radiogroup.name] == 'sportss') { this.setdisabled(false); this.removecls("sports-item-disabled"); if (sportsgrid.holdvalue) { var footballpanel = sportsgrid.up('panel'); footballpanel.setvalue(sportsgrid.holdvalue); } } else { this.setdisabled(true); this.addcls("sports-item-disabled"); **if (sportsgrid.store.getcount() > 0) { var footballpanel = sportsgrid.up('panel'); footballpanel.holdvalue = footballpanel.getvalue(); footballpanel.setvalue(); sportsgrid.addcls("sports-item-disabled"); }** } },
working code without modification
sportscontainerhandler: function(radiogroup, newvalue, oldvalue, options) { var sportscustomparams = options.sportscustomparams; var uipage = this.up('football-ux-sports-ui-page'); var sportsdefinition = metamodelshelper.getsportsdefinition( uipage, sportscustomparams.sportshandlerdefinitionid); var sportsfieldparam = sportsdefinition.params['sportsmultifieldname']; var sportsgrid = uipage.querybyid(sportsfieldparam.defaultvalue).grid; if (newvalue[radiogroup.name] == 'sportss') { this.setdisabled(false); this.removecls("sports-item-disabled"); if (sportsgrid.holdvalue) { var footballpanel = sportsgrid.up('panel'); footballpanel.setvalue(sportsgrid.holdvalue); } } else { this.setdisabled(true); this.addcls("sports-item-disabled"); if (sportsgrid.store.getcount() > 0) { sportsgrid.holdvalue = sportsgrid.store.data.items; sportsgrid.store.loaddata([]); sportsgrid.addcls("sports-item-disabled"); } } },
getvalue()
not method of extjs panel class.
the change in code, sportsgrid
(ext.grid.panel) footbalpanel
(ext.panel.panel) won't work, because different classes , therefore have different properties , methods.
if want code work, you'll need implement getvalue()
, setvalue()
. example, like:
on footballpanel class:
getvalue: function () { return this.down('grid').store.data.items; }, setvalue: function (newvalue) { if (!newvalue) newvalue = new array(); this.down('grid').store.loaddata(newvalue); },
and use modified code:
sportscontainerhandler: function(radiogroup, newvalue, oldvalue, options) { var sportscustomparams = options.sportscustomparams; var uipage = this.up('football-ux-sports-ui-page'); var sportsdefinition = metamodelshelper.getsportsdefinition( uipage, sportscustomparams.sportshandlerdefinitionid); var sportsfieldparam = sportsdefinition.params['sportsmultifieldname']; var sportsgrid = uipage.querybyid(sportsfieldparam.defaultvalue).grid; if (newvalue[radiogroup.name] == 'sportss') { this.setdisabled(false); this.removecls("sports-item-disabled"); if (sportsgrid.holdvalue) { var footballpanel = sportsgrid.up('panel'); footballpanel.setvalue(sportsgrid.holdvalue); } } else { this.setdisabled(true); this.addcls("sports-item-disabled"); if (sportsgrid.store.getcount() > 0) { var footballpanel = sportsgrid.up('panel'); footballpanel.holdvalue = footballpanel.getvalue(); footballpanel.setvalue([]); sportsgrid.addcls("sports-item-disabled"); } } },
Comments
Post a Comment