开发者

How to reload checkbox in itemrenderer

I am having a problem with a checkbox in my datagrid. It pulls in a dataprovider (xml file) and I am using it to set the checkbox selection with a custom itemrenderer. I then save the datagrid, when updated, back to the xml file.

The checkbox, when clicked, saves to the xml fine.. I know this because when I reload the application it shows the correct result. However, when I just refresh the dataprovider without closing out the flex application then the checkboxes revert back to what they were before the change.

So here is the custom checkbox:

<?xml version="1.0" encoding="utf-8"?>
<mx:CheckBox xmlns:mx="http://www.adobe.com/2006/mxml"   >
 <mx:Script>
  <![CDATA[
   override public function set data( value:Object ):void{
    super.data = value;

    trace("data = " + data.@hidden);
    if(data.@hidden == "true")
    {
     this.selected = true;

    }else
    {
     this.selected =  false;
    }
   }
  ]]开发者_如何学运维>
 </mx:Script>
</mx:CheckBox>

And here is where I am calling it:

<mx:DataGridColumn width="75" headerText="hide?" dataField="@hidden">
    <mx:itemRenderer>
     <mx:Component>
      <local:itemRendCheckBox />
     </mx:Component>
    </mx:itemRenderer>
</mx:DataGridColumn>

I imagine what is happening is that everything is updating except the custome itemrenderer. Is there something I can do to tell the checkbox to refresh with the dataprovider?


I think I figured it out, I was calling the datagrid to refresh, which is different then refreshing the actual dataprovider. So instead of myDataGrid.send() I called dataProv.dataprovider.refresh();

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜