javascript - modified code is not correct for the getvalue and setvalue -


  1. my code working fine wanted change code....
    1. they wanted attach setvalue , getvalue added directly footballpanel instead of sports grid,
    2. but after adding code not working fine...
    3. can guys tell me why not working....
    4. providing modified code below...
    5. the ui action here performing there 2 radio buttons, when click each radio button 2 different grids open
    6. in 1 of grid add value, when switch radio button values in grid disappears should not disappear...
    7. 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

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -