Harshali
Harshali

Reputation: 281

flex:how to make some sparkgrid columns editable

I want to make two spark grid columns editable on check box click event.I have written following code for that. but i dont have java function to implement this. so can anyone plz help me..?

<s:DataGrid id="dataGrid" x="3" y="44" width="792" height="243" editable="true"  fontSize="15"
requestedRowCount="4" dataProvider="{getSalesReturnCgt.lastResult}">
<s:columns>
<s:ArrayList>
<s:GridColumn dataField="selectFlag" rendererIsEditable="true"  headerText="SrNo"      width="60" editable="false">
<s:itemRenderer>
<fx:Component>
<s:GridItemRenderer>
<s:layout>
<s:HorizontalLayout horizontalAlign="center" verticalAlign="middle"/>
</s:layout>
</fx:Script>
<s:Label id="srno" text="{cgtsrobj.sr_no}" />
<s:CheckBox id="chkBox" click="chkBox_clickHandler(event)" />   
</s:GridItemRenderer>
</fx:Component>
</s:itemRenderer>
</s:GridColumn>
<s:GridColumn dataField="lot_Id" headerText="Item"></s:GridColumn>
<s:GridColumn dataField="lot_Description" headerText="Item Description"></s:GridColumn>
<s:GridColumn dataField="local_Price" headerText="Rate"></s:GridColumn>
<s:GridColumn dataField="discount" headerText="Discount"></s:GridColumn>
<s:GridColumn dataField="available_qty" headerText="Avail Qty"></s:GridColumn>
<s:GridColumn dataField="return_qty" headerText="Return Qty" id="txtReturn">
<s:itemEditor>
<fx:Component>
<s:TextInput  restrict="0-9" width="20" visible="true" />
</fx:Component>
</s:itemEditor>
</s:GridColumn>
<s:GridColumn dataField="sales_qty" headerText="Sales Qty" >
<s:itemEditor>
<fx:Component>
<s:TextInput restrict="0-9" width="20" visible="true" />     
</fx:Component>
</s:itemEditor>
</s:GridColumn>
<s:GridColumn dataField=" " headerText="Amount"></s:GridColumn>
</s:ArrayList>
</s:columns>

Upvotes: 1

Views: 426

Answers (1)

Vaibhav
Vaibhav

Reputation: 1477

First of all, you dont need java code for this, now to achieve this, write the chkBox_clickHandler function, from there you should dispatch an event which you should handle in GridItemEditor

Upvotes: 1

Related Questions