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.