I was able to figure out the way to fix the issue. I am not sure if its the
best or correct. But this works for me now.
I updated the itemClickEvent to update the data grids data provider with the
value returned from the popup. Any suggestions are most welcome. And wish
this would help somebody if they are looking such kind of inline Item
Editors.
private function itemClickEvent(event:ListEvent):void {
txtCurrency.setFocus();
txtCurrency.text=event.currentTarget.selectedItem.dataField1;
var myDG:DataGrid=this.owner as DataGrid;
data.currency = txtCurrency.text;
myDG.dataProvider.itemUpdated(data);
PopUpManager.removePopUp(pop1);
}
Thanks
Kiran
On Wed, May 19, 2010 at 10:34 AM, Kiran Kumar Reddy <
[email protected]> wrote:
> Dear Friends,
>
> Hope every one is doing good. I need small help on *item Editor for data
> grid.*
>
> What I am doing: I am creating an Item Editor for Data grid which would
> have Text input and image. Clicking on image would bring up a popup window
> with available currencies and description in a Data Grid.
> By selecting and one currencies in popup grid should display the currency
> in the Text Input. I am creating inline item editor with the bellow code.
>
> Problem I am Facing: I am able to bring up the popup and selecting an
> Currency is assigned to the Text Input (which I can find by using Alert msg
> in ItemClickEvent of the Popup Grid) but the value doesn't really appear in
> the Text Input.
>
> Any help on this would be appreciated. Pls I need only the Item Editor and
> not the component with both Item Renderer and Editor. I have seen these real
> good examples on net with item Renderer and Editor but are not really
> helpful for me in this context.
>
>
> *CODE:*
>
> <mx:DataGridColumn headerText="Currency *" dataField="currency"
> editable="true" editorDataField="value">
> <mx:itemEditor>
> <mx:Component className = "CurrencyEditor">
> <mx:HBox>
> <mx:Script>
> <![CDATA[
> import mx.controls.List;
> import mx.collections.ArrayCollection;
> import mx.events.ListEvent;
> import mx.events.FlexEvent;
> import component.MagnifierWindow;
> import mx.managers.PopUpManager;
> private var pop1:MagnifierWindow;
> public function get value() : String {
> return txtCurrency.text;
> }
> override public function set data(value:Object):void{
> super.data = value;
> txtCurrency.text = data.currency;
> }
> private function itemClickEvent(event:ListEvent):void {
>
> txtCurrency.text=event.currentTarget.selectedItem.dataField1;
> txtCurrency.dispatchEvent(new
> FlexEvent(FlexEvent.DATA_CHANGE));
> PopUpManager.removePopUp(pop1);
> txtCurrency.setFocus();
> }
> public function fnCurrency():void {
> pop1 = MagnifierWindow(PopUpManager.createPopUp(this,
> MagnifierWindow, true));
> pop1["dg"].addEventListener(ListEvent.ITEM_CLICK,
> itemClickEvent);
> pop1.title="Magnifier Window";
> pop1.showCloseButton=true;
> // This fields for returning values form the magnifier
> window to the main window
> pop1.targetField1 = txtCurrency;
> // Assigning DataGrid Headers.
> pop1.headeName1 = "Currency";
> pop1.headeName2 = "Description";
> var pt:Point = new Point(0, 0);
> pt = parentApplication.localToGlobal(pt); // Convert
> refAnchor's local 0,0 into global coordinate
> pt = pop1.globalToLocal(pt); // Convert the result into
> local coordinate of myPop
> pop1.move(Math.round((parentApplication.width -
> pop1.width) / 2) + pt.x, Math.round((parentApplication.height - pop1.height)
> / 2) + pt.y);
> }]]>
> </mx:Script>
> <mx:TextInput id="txtCurrency" maxChars="3" fontSize="12"
> fontWeight="normal" fontFamily="Verdana" textAlign="left" restrict="A-Z"/>
> <mx:Image id="imgCurrency" source="assets/img/Mag.png"
> useHandCursor="true" click="fnCurrency()"/>
> </mx:HBox>
> </mx:Component>
> </mx:itemEditor>
> </mx:DataGridColumn>
>
--
You received this message because you are subscribed to the Google Groups "Flex
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/flex_india?hl=en.