2011-12-22 61 views
0

IM我的Flex应用程序,我有一个datgrid 如下柔性数据网格复选框渲染

<mx:DataGrid id="grid" > 
<mx:columns> 
    <mx:DataGridColumn headerText="Select" dataField="itemSelInd" editable="false" textAlign="center" > 
           <mx:itemRenderer > 
            <mx:Component> 
            <mx:CheckBox> 
           </mx:CheckBox> 
            </mx:Component> 
           </mx:itemRenderer> 
          </mx:DataGridColumn> 
    <mx:DataGridColumn dataField="name" headerText="Name"/> 
    <mx:DataGridColumn dataField="date" headerText="Date"/> 
    <mx:DataGridColumn dataField="month" headerText="Month"/> 
    <mx:DataGridColumn dataField="year" headerText="Year"/> 


</mx:columns> </mx:DataGrid> 

默认编辑= FALSE;

现在,如果我选择一个复选框,单独的corressponding行应该可以编辑它如何可能? 给我一些建议..thankxx提前!

回答

2

试试这个

<mx:ArrayCollection id="sad"> 
<mx:source> 
    <mx:Object itemSelInd="true" named="sudharsanan" date="0" month="4" year="1989"/> 
    <mx:Object itemSelInd="false" named="sudharsanan" date="1" month="4" year="1989"/> 
    <mx:Object itemSelInd="true" named="sudharsanan" date="0" month="4" year="1989"/> 
</mx:source> 
</mx:ArrayCollection> 
    <mx:DataGrid id="asad" editable="true" dataProvider="{sad}"> 
     <mx:columns> 
      <mx:DataGridColumn headerText="Select" dataField="itemSelInd" editable="false" textAlign="center" > 
             <mx:itemRenderer > 
              <mx:Component> 
               <mx:CheckBox click="{data.itemSelInd = !data.itemSelInd}"/> 
              </mx:Component> 
             </mx:itemRenderer> 
            </mx:DataGridColumn> 
      <mx:DataGridColumn dataField="named" headerText="Name" > 
       <mx:itemEditor> 
         <mx:Component> 
          <mx:TextInput editable="{data.itemSelInd}" text="{data.named}"/> 
         </mx:Component> 
        </mx:itemEditor> 
      </mx:DataGridColumn> 
      <mx:DataGridColumn dataField="date" headerText="Date" > 
       <mx:itemEditor> 
        <mx:Component> 
         <mx:TextInput editable="{data.itemSelInd}" text="{data.date}"/> 
        </mx:Component> 
       </mx:itemEditor> 
      </mx:DataGridColumn> 

     </mx:columns> 
    </mx:DataGrid> 

我希望这可以帮助你

+1

这只会工作,如果物业'data.itemSelInd'是绑定的。 – LoremIpsum 2011-12-22 10:50:47

+0

@ LoremIpsum我试过它为我工作。 – Exhausted 2011-12-22 11:11:38

+0

我已经添加了我的完整代码 – Exhausted 2011-12-22 11:20:52