flex itemrenderer prevents datagrid item select -
i'm new flex , have encountered problem itemrenderer can't find solution to. i've asked coworker plenty of flex experience, , i've tried searching internet no luck.
problem have datagrid in each column uses itemrenderer display information, , reason causes user unable select of datagrid rows. think must have itemrenderer, because when added dummy column without itemrenderer, able highlight , select row clicking on dummy column, others still did not work. i've tried comparing code code other datagrids itemrenderers work, haven't been able find differences cause problem mine giving me. know why happen?
thank you!
my datagrid (i tried include think should relevant keep things concise. if thinks more information needed, please let me know!):
<mx:datagrid id="servicegridui" left="10" right="10" top="10" bottom="85" selectable="true" stylename="formdatagrid" variablerowheight="true" tooltip="double-click view."> <mx:columns> <mx:datagridcolumn headertext="id" datafield="id" width="175"> <mx:itemrenderer> <mx:component> <mx:hbox paddingbottom="3" height="70" paddingleft="5" horizontalgap="1" paddingtop="2" horizontalscrollpolicy="off" verticalscrollpolicy="off"> <mx:text height="100%" width="100%" id="id" htmltext="" selectable="true" doubleclick="opendoc(event)" doubleclickenabled="true"/> <mx:script> <![cdata[ var refid:string = ""; override public function set data(value:object):void { //variables setting text created here id.htmltext = 'id: ' + refid + '<br><font color="#666666">service id: ' + servid + '</font>'; id.htmltext +='<br><font color="#666666">type , specialty: ' + type + ' - ' + specialty + '</font>'; } public function opendoc(event:mouseevent):void { //removed due irrelevance } ]]> </mx:script> </mx:hbox> </mx:component> </mx:itemrenderer> </mx:datagridcolumn> <mx:datagridcolumn headertext="claimant" datafield="claimantheader" width="125"> <mx:itemrenderer> <mx:component> <mx:hbox paddingbottom="3" height="70" paddingleft="5" horizontalgap="1" paddingtop="2" horizontalscrollpolicy="off" verticalscrollpolicy="off"> <mx:text height="100%" width="100%" id="claimant" htmltext="" selectable="true" doubleclick="opendoc(event)" doubleclickenabled="true"/> <mx:script> <![cdata[ var refid:string = ""; override public function set data(value:object):void { //variables setting text created here claimant.htmltext = 'claim: ' + claim + '<br><font color="#666666">name: '+ name +'</font>'; claimant.htmltext +='<br><font color="#666666">date: '+ date+'</font>'; } // opens new browser window , loads file public function opendoc(event:mouseevent):void { //removed due irrelevance } ]]> </mx:script> </mx:hbox> </mx:component> </mx:itemrenderer> </mx:datagridcolumn> <mx:datagridcolumn headertext="status" datafield="statusheader" width="70"> <mx:itemrenderer> <mx:component> <mx:hbox paddingbottom="3" height="70" paddingleft="5" horizontalgap="1" paddingtop="2" horizontalscrollpolicy="off" verticalscrollpolicy="off" > <mx:text height="100%" width="100%" id="status" htmltext="" selectable="true" doubleclick="opendoc(event)" doubleclickenabled="true"/> <mx:script> <![cdata[ var refid:string = ""; override public function set data(value:object):void { //variables setting text created here status.htmltext = 'date: ' + refdate; status.htmltext += '<br><font color="#666666">status: ' + currstatus + '</font>'; } // opens new browser window , loads file public function opendoc(event:mouseevent):void { //removed due irrelevance } ]]> </mx:script> </mx:hbox> </mx:component> </mx:itemrenderer> </mx:datagridcolumn> <mx:datagridcolumn headertext="lalala" datafield="serviceid" width="50"/><!---this dummy column created , 1 functions properly--> </mx:columns> </mx:datagrid>
when override set data function, need say
super.data = value;
it fix problem. if want run complete application, here example based on code:
<?xml version="1.0"?> <mx:application xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:script><![cdata[ import mx.collections.arraycollection; [bindable] private var myarraycollection:arraycollection = new arraycollection([ {id:"1",claimantheader: "claimheader1",statusheader:"statusheader1", serviceid:"sid1" , servid:"1001", name:"bikram dangol", type:"type 1",specialty:"speciality 1", claim:"claim 1", date:"12/06/2014", refdate:"11/06/2014", currstatus:"active"}, {id:"2",claimantheader: "claimheader2",statusheader:"statusheader2", serviceid:"sid2", servid:"1002", name:"anup dangol", type:"type 2",specialty:"speciality 2", claim:"claim 2", date:"12/07/2014", refdate:"11/07/2014", currstatus:"inactive"}, {id:"3",claimantheader: "claimheader3",statusheader:"statusheader3", serviceid:"sid3", servid:"1003",name:"lunish yakami", type:"type 3",specialty:"speciality 3", claim:"claim 3", date:"12/08/2014", refdate:"11/08/2014", currstatus:"onhold"}, ]); ]]></mx:script> <mx:datagrid id="servicegridui" left="10" right="10" top="10" bottom="85" selectable="true" dataprovider="{myarraycollection}" stylename="formdatagrid" variablerowheight="true" tooltip="double-click view."> <mx:columns> <mx:datagridcolumn headertext="id" datafield="id" width="175"> <mx:itemrenderer> <mx:component> <mx:hbox paddingbottom="3" height="70" paddingleft="5" horizontalgap="1" paddingtop="2" horizontalscrollpolicy="off" verticalscrollpolicy="off"> <mx:text height="100%" width="100%" id="id" htmltext="" selectable="true" doubleclick="opendoc(event)" doubleclickenabled="true"/> <mx:script> <![cdata[ var refid:string = ""; override public function set data(value:object):void { super.data = value; //variables setting text created here id.htmltext = 'id: ' + refid + '<br><font color="#666666">service id: ' + data.servid + '</font>'; id.htmltext +='<br><font color="#666666">type , specialty: ' + data.type + ' - ' + data.specialty + '</font>'; } public function opendoc(event:mouseevent):void { //removed due irrelevance } ]]> </mx:script> </mx:hbox> </mx:component> </mx:itemrenderer> </mx:datagridcolumn> <mx:datagridcolumn headertext="claimant" datafield="claimantheader" width="125"> <mx:itemrenderer> <mx:component> <mx:hbox paddingbottom="3" height="70" paddingleft="5" horizontalgap="1" paddingtop="2" horizontalscrollpolicy="off" verticalscrollpolicy="off"> <mx:text height="100%" width="100%" id="claimant" htmltext="" selectable="true" doubleclick="opendoc(event)" doubleclickenabled="true"/> <mx:script> <![cdata[ var refid:string = ""; override public function set data(value:object):void { super.data = value; //variables setting text created here claimant.htmltext = 'claim: ' + data.claim + '<br><font color="#666666">name: '+ data.name +'</font>'; claimant.htmltext +='<br><font color="#666666">date: '+ data.date+'</font>'; } // opens new browser window , loads file public function opendoc(event:mouseevent):void { //removed due irrelevance } ]]> </mx:script> </mx:hbox> </mx:component> </mx:itemrenderer> </mx:datagridcolumn> <mx:datagridcolumn headertext="status" datafield="statusheader" width="70"> <mx:itemrenderer> <mx:component> <mx:hbox paddingbottom="3" height="70" paddingleft="5" horizontalgap="1" paddingtop="2" horizontalscrollpolicy="off" verticalscrollpolicy="off" > <mx:text height="100%" width="100%" id="status" htmltext="" selectable="true" doubleclick="opendoc(event)" doubleclickenabled="true"/> <mx:script> <![cdata[ var refid:string = ""; override public function set data(value:object):void { super.data = value; //variables setting text created here status.htmltext = 'date: ' + data.refdate; status.htmltext += '<br><font color="#666666">status: ' + data.currstatus + '</font>'; } // opens new browser window , loads file public function opendoc(event:mouseevent):void { //removed due irrelevance } ]]> </mx:script> </mx:hbox> </mx:component> </mx:itemrenderer> </mx:datagridcolumn> <mx:datagridcolumn headertext="lalala" datafield="serviceid" width="50"/><!---this dummy column created , 1 functions properly--> </mx:columns> </mx:datagrid> </mx:application>
Comments
Post a Comment