CCBRONET
asked on
What kind of datagrid event do i need to use to set data in an ArrayCollection
Would like to know what kind of datagrid event i can use to set the data on change into the ArrayCollection......
I have attached the mxml module....
Thanks In Advance....
I have attached the mxml module....
Thanks In Advance....
<?xml version="1.0" encoding="utf-8"?>
<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:model="com.citizen.cbs.model.*"
xmlns:index="com.citizen.cbs.index.*"
creationComplete="onCreationComplete()" initialize="initApp()"
layout="absolute" xmlns:customcomponents="com.citizen.cbs.customcomponents.*">
<mx:RemoteObject id="utilityUCFlexRO" destination="utilityUCFlexRO">
<mx:method name="updateStationDetails" result="updateStationResult(event)" fault="updateStationFault(event)"/>
</mx:RemoteObject>
<mx:RemoteObject id="branchDetailsUCFlexRO" destination="branchDetailsUCFlexRO">
<mx:method name="getBranchList" result="handleBranchListResult(event)" fault="handleBranchListFault(event)" />
</mx:RemoteObject>
<mx:RemoteObject id="accountOpenUCFlexRO" destination="accountOpenUCFlexRO">
<mx:method name="getProdId" result="handleProdIdResult(event)" fault="handleProdIdFault(event)"/>
<mx:method name="getTitleCodes" result="handleTitleCodesResult(event)" fault="handleTitleCodesFault(event)"/>
</mx:RemoteObject>
<mx:RemoteObject id="accountModifyUCFlexRO" destination="accountModifyUCFlexRO">
<mx:method name="getUimRecord" result="handleUimRecordResult(event)" fault="handleUimRecordFault(event)"/>
<mx:method name="getAcHolderNameAndTitle" result="handleAcHolderDetailsResult(event)" fault="handleAcHolderDetailsFault(event)"/>
<mx:method name="modifyNameDetails" result="handleModifyNameDetailsResult(event)" fault="handleModifyNameDetailsFault(event)"/>
</mx:RemoteObject>
<mx:Script>
<![CDATA[
import com.citizen.cbs.CitizenApplication;
import com.citizen.cbs.model.CodeEbank;
import com.citizen.cbs.model.CodeGl;
import com.citizen.cbs.model.CodeTitle;
import com.citizen.cbs.model.UniqueIdMaster;
import com.citizen.cbs.modules.accountmaintenance.nameTitle;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.core.Application;
import mx.events.CloseEvent;
import mx.events.DataGridEvent;
import mx.events.ListEvent;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
[Bindable]
private var attemptNo:int=0;
[Bindable]
private var branchCodes:ArrayCollection=new ArrayCollection();
[Bindable]
private var prodCodes:ArrayCollection=new ArrayCollection();
[Bindable]
public var titleCodes:ArrayCollection=new ArrayCollection();
[Bindable]
private var progmode:String=null;
[Bindable]
public var branch:int;
[Bindable]
public var branch1:int;
[Bindable]
public var productId:int;
[Bindable]
private var uniqueIdMaster:UniqueIdMaster;
[Bindable]
private var accountHolders:ArrayCollection = new ArrayCollection();
[Bindable]
private var particularDetails:ArrayCollection = new ArrayCollection();
[Bindable]
private var custId:int=0;
[Bindable]
private var acHolderDetails:ArrayCollection = new ArrayCollection();
[Bindable]
private var tableData:ArrayCollection = new ArrayCollection();
[Bindable]
private var acname:String = null;
[Bindable]
private var NameTitle:nameTitle;
[Bindable]
private var titleArray:ArrayCollection = new ArrayCollection();
private function btnCancelClicked():void
{
utilityUCFlexRO.updateStationDetails("MM0000");
}
private function btnResetClicked():void
{
hlSearch.enabled = true;
cmbProdId.enabled = true;
txtAcNo.enabled = true;
btnOK.enabled = false;
cmbProdId.selectedIndex=0;
txtAcNo.text=null;
accountHolders = new ArrayCollection();
titleArray = new ArrayCollection();
}
private function initApp():void
{
utilityUCFlexRO.updateStationDetails(CitizenApplication.menuParameters["modulecode"]);
}
private function updateStationResult(event:ResultEvent):void
{
attemptNo=attemptNo+1;
if(attemptNo>1)
{
Application.application.unloadModule();
}
}
private function updateStationFault(event:FaultEvent):void
{
Alert.show("in update station fault : "+event.fault.faultString+" ");
}
private function onCreationComplete():void
{
branchDetailsUCFlexRO.getBranchList();
progmode=CitizenApplication.menuParameters["action"];
if(progmode == "Modify")
{
btnOK.enabled=false;
}
}
private function handleBranchListResult(event:ResultEvent):void
{
branchCodes = ArrayCollection(event.result);
branch1 = branchCodes.getItemAt(0).bdBranchNo;
branch = branchCodes.getItemAt(0).bdBranchNo;
if(branch1==400209001)
{
cmbBranch.visible=true;
lblBranch.visible=true;
}
else
{
var c:CodeEbank = new CodeEbank();
c.cebMicr=branch;
cmbBranch.selectedIndex= 0;
cmbBranch.visible=true;
lblBranch.visible=true;
cmbBranch.enabled=false;
}
accountOpenUCFlexRO.getProdId();
}
private function handleBranchListFault(event:FaultEvent):void
{
Alert.show("in branch read fault : "+event.fault.faultString+" ");
}
private function handleProdIdResult(event:ResultEvent):void
{
prodCodes=ArrayCollection(event.result);
accountOpenUCFlexRO.getTitleCodes();
}
private function handleProdIdFault(event:FaultEvent):void
{
Alert.show("in prod id fault"+event.fault.faultString+" ");
}
private function handleTitleCodesResult(event:ResultEvent):void
{
titleCodes=ArrayCollection(event.result);
}
private function handleTitleCodesFault(event:FaultEvent):void
{
Alert.show("title fault"+event.fault.faultString+" ");
}
private function hlSearchDetailsClicked():void
{
if(cmbProdId.selectedItem==null || CodeGl(cmbProdId.selectedItem).cglCode==0)
{
Alert.show("Please Select the Product ID");
}
else
{
if(txtAcNo.text ==null || txtAcNo.text=="")
{
Alert.show("Please Enter the Account No.");
}
else
{
productId=CodeGl(cmbProdId.selectedItem).cglCode;
var prodId:int=CodeGl(cmbProdId.selectedItem).cglCode;
var acNo:int=Number(txtAcNo.text);
accountModifyUCFlexRO.getUimRecord(branch,prodId,acNo,progmode);
}
}
}
private function handleUimRecordResult(event:ResultEvent):void
{
this.uniqueIdMaster=UniqueIdMaster(event.result);
if(!(uniqueIdMaster==null))
{
custId=uniqueIdMaster.id.uimCustomerId;
hlSearch.enabled = false;
cmbProdId.enabled = false;
txtAcNo.enabled = false;
accountModifyUCFlexRO.getAcHolderNameAndTitle(branch,CodeGl(cmbProdId.selectedItem).cglCode,Number(txtAcNo.text),custId);
}
}
private function handleUimRecordFault(event:FaultEvent):void
{
Alert.show("uim fault : "+event.fault.faultString);
}
private function handleAcHolderDetailsResult(event:ResultEvent):void
{
acHolderDetails = ArrayCollection(event.result);
if(productId == 101 || productId == 102 || productId == 103)
{
for(var i:int = 0 ; i < acHolderDetails.length; i++)
{
titleArray.addItemAt({name:acHolderDetails.getItemAt(i).samName,
title:acHolderDetails.getItemAt(i).codeTitle.ctCode},i);
}
}
else if(productId == 104)
{
Alert.show("acHolderDetails: "+acHolderDetails.length);
for(var i:int = 0 ; i < acHolderDetails.length; i++)
{
titleArray.addItemAt({name:acHolderDetails.getItemAt(i).camName,
title:acHolderDetails.getItemAt(i).codeTitle.ctCode},i);
}
}
else if(productId.toString().charAt(0)=="4")
{
for(var i:int = 0 ; i < acHolderDetails.length; i++)
{
titleArray.addItemAt({name:acHolderDetails.getItemAt(i).tamName,
title:acHolderDetails.getItemAt(i).codeTitle.ctCode},i);
}
}
btnOK.enabled = true;
}
private function handleAcHolderDetailsFault(event:FaultEvent):void
{
Alert.show("Ac Holder Details Fault : "+event.fault.faultString+" ");
}
private function okClicked():void
{
Alert.show("Name: "+titleArray.getItemAt(0).name);
Alert.show("Title: "+titleArray.getItemAt(0).codeTitle.ctCode);
Alert.show("Title Desc: "+titleArray.getItemAt(0).codeTitle.ctDesc);
Alert.show("Title Array: "+titleArray.length);
}
private function handleModifyNameDetailsResult(event:ResultEvent):void
{
Alert.show(event.result.toString());
btnResetClicked();
}
private function handleModifyNameDetailsFault(event:FaultEvent):void
{
Alert.show("modifyAccNameDetailsFault : "+event.fault.faultString+" ");
}
public function processData():void
{
var index:int = dg1.selectedIndex;
titleArray.setItemAt({name: dg1.selectedItem.name, title: dg1.selectedItem.ctCode},index);
}
]]>
</mx:Script>
<index:GetIndex id="getIndex"/>
<mx:Panel x="0" y="0" layout="absolute" title="A/c Holder's Name Modify">
<mx:VBox>
<mx:Spacer height="10"/>
<mx:HBox x="0" y="10" horizontalAlign="center" verticalAlign="middle">
<mx:Spacer width="15"/>
<mx:Label text="Branch:" id="lblBranch"/>
<mx:ComboBox id="cmbBranch" dataProvider="{branchCodes}" labelField="bdBranchName"/>
<mx:Spacer width="10"/>
<mx:Label text="Product ID:"/>
<mx:ComboBox id="cmbProdId" dataProvider="{prodCodes}" labelField="cglDesc"/>
<mx:Spacer width="10"/>
<mx:Label text="Account No.:"/>
<mx:TextInput width="100" id="txtAcNo" restrict="0-9"/>
<mx:Spacer width="10"/>
<mx:LinkButton label="Search" id="hlSearch" click="hlSearchDetailsClicked()"/>
<mx:Spacer width="15"/>
</mx:HBox>
<mx:Spacer height="20"/>
<mx:DataGrid x="0" y="61" width="100%" dataProvider="{titleArray}" id="dg1" change="processData()">
<mx:columns>
<mx:DataGridColumn width="100" id="dgc1" rendererIsEditor="true" headerText="Title" editable="true"
editorDataField="value" dataField="title">
<mx:itemRenderer>
<mx:Component>
<customcomponents:GridComboBox dataProvider="{parentDocument.titleCodes}"
labelField="ctDesc" lookupField="ctCode"
color="#000000"/>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn headerText="Name" id="dgc2" editable="true" dataField="name" editorDataField="text">
<mx:itemRenderer>
<mx:Component>
<mx:TextInput restrict="A-Z a-z" maxChars="50" editable="true" />
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
<mx:Spacer height="20"/>
</mx:VBox>
<mx:ControlBar y="289" height="59">
<mx:Button label="OK" width="80" id="btnOK" click="okClicked()"/>
<mx:Button label="RESET" width="80" id="btnReset" click="btnResetClicked()"/>
<mx:Button label="CANCEL" width="80" id="btnCancel" click="btnCancelClicked()"/>
</mx:ControlBar>
</mx:Panel>
</mx:Module>
itemEditEnd getting fired when user modified a field but you are asking when data change in this case you need to listen CollectionEvent.COLLECTION _CHANGE.
http://livedocs.adobe.com/flex/3/html/help.html?content=about_dataproviders_5.html
http://livedocs.adobe.com/flex/3/html/help.html?content=about_dataproviders_5.html
It all depends on when you want to dispatch the event. There are multiple events you can use --
1. itemEditEnd
2. itemEditBegin
3. itemEditBeginning
4. CollectionEvent.Collection Change
5. itemClick
.....etc
Please tell us the specific case you want to listen for an event. I can tell you better once I've that information.
1. itemEditEnd
2. itemEditBegin
3. itemEditBeginning
4. CollectionEvent.Collection
5. itemClick
.....etc
Please tell us the specific case you want to listen for an event. I can tell you better once I've that information.
ASKER
I made a change for the combo box component
<mx:DataGrid x="0" y="61" width="100%" dataProvider="{titleArray} " id="dg1" itemEditEnd="processData(e vent)">
<mx:columns>
<mx:DataGridColumn width="100" id="dgc1" rendererIsEditor="true" headerText="Title" editable="true"
editorDataField="value" dataField="title">
<mx:itemRenderer>
<mx:Component>
<customcomponents:GridComb oBox dataProvider="{parentDocum ent.titleC odes}"
labelField="ctDesc" lookupField="ctCode"
color="#000000" change="dispatchEvent(new mx.events.DataGridEvent(mx .events.Da taGridEven t.ITEM_FOC US_OUT, true, true));"/>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn headerText="Name" id="dgc2" editable="true" dataField="name" editorDataField="text">
<mx:itemRenderer>
<mx:Component>
<mx:TextInput restrict="A-Z a-z" maxChars="50" editable="true"/>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
This "change="dispatchEvent(new mx.events.DataGridEvent(mx .events.Da taGridEven t.ITEM_FOC US_OUT, true, true));"
Updates the data provider dynamically.....How do do this for the text input component....
Thanks In Advance....
<mx:DataGrid x="0" y="61" width="100%" dataProvider="{titleArray}
<mx:columns>
<mx:DataGridColumn width="100" id="dgc1" rendererIsEditor="true" headerText="Title" editable="true"
editorDataField="value" dataField="title">
<mx:itemRenderer>
<mx:Component>
<customcomponents:GridComb
labelField="ctDesc" lookupField="ctCode"
color="#000000" change="dispatchEvent(new mx.events.DataGridEvent(mx
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn headerText="Name" id="dgc2" editable="true" dataField="name" editorDataField="text">
<mx:itemRenderer>
<mx:Component>
<mx:TextInput restrict="A-Z a-z" maxChars="50" editable="true"/>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
This "change="dispatchEvent(new
Updates the data provider dynamically.....How do do this for the text input component....
Thanks In Advance....
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can use various events --
change="dispatchEvent(new mx.events.DataGridEvent(mx .events.Da taGridEven t.ITEM_FOC US_OUT, true, true));
valueCommit="dispatchEvent (new mx.events.DataGridEvent(mx .events.Da taGridEven t.ITEM_FOC US_OUT, true, true));
textInput="dispatchEvent(n ew mx.events.DataGridEvent(mx .events.Da taGridEven t.ITEM_FOC US_OUT, true, true));
focusIn="dispatchEvent(new mx.events.DataGridEvent(mx .events.Da taGridEven t.ITEM_FOC US_OUT, true, true));
foucsOut="dispatchEvent(ne w mx.events.DataGridEvent(mx .events.Da taGridEven t.ITEM_FOC US_OUT, true, true));
change="dispatchEvent(new mx.events.DataGridEvent(mx
valueCommit="dispatchEvent
textInput="dispatchEvent(n
focusIn="dispatchEvent(new
foucsOut="dispatchEvent(ne
ASKER
Hey I have tried the above n i get an error.....
<mx:DataGridColumn headerText="Name" id="dgc2" editable="true" dataField="name" editorDataField="text">
<mx:itemRenderer>
<mx:Component>
<mx:TextInput restrict="A-Z a-z" maxChars="50" editable="true"
change="dispatchEvent(new mx.events.DataGridEvent(mx .events.Da taGridEven t.ITEM_FOC US_OUT, true, true));"/>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
Error Msg: 1120: Access of undefined property mx.
<mx:DataGridColumn headerText="Name" id="dgc2" editable="true" dataField="name" editorDataField="text">
<mx:itemRenderer>
<mx:Component>
<mx:TextInput restrict="A-Z a-z" maxChars="50" editable="true"
change="dispatchEvent(new mx.events.DataGridEvent(mx
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
Error Msg: 1120: Access of undefined property mx.
If you are getting the above error that means you've forgotten to include the mx namespace in your application. Make sure you have the following in your application --
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
ASKER
Hey VickyMad
That is already mentioned in the beginning of my module.....
<?xml version="1.0" encoding="utf-8"?>
<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:model="com.citizen.c bs.model.* "
xmlns:index="com.citizen.c bs.index.* "
creationComplete="onCreati onComplete ()" initialize="initApp()"
layout="absolute" xmlns:customcomponents="co m.citizen. cbs.custom components .*">
That is already mentioned in the beginning of my module.....
<?xml version="1.0" encoding="utf-8"?>
<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:model="com.citizen.c
xmlns:index="com.citizen.c
creationComplete="onCreati
layout="absolute" xmlns:customcomponents="co
Hi,
Can you post the complete code please ? How are you loading this module ? I'll have to see that part as well.
Can you post the complete code please ? How are you loading this module ? I'll have to see that part as well.
ASKER
<?xml version="1.0" encoding="utf-8"?>
<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:model="com.citizen.c bs.model.* "
xmlns:index="com.citizen.c bs.index.* "
creationComplete="onCreati onComplete ()" initialize="initApp()"
layout="absolute" xmlns:customcomponents="co m.citizen. cbs.custom components .*">
<mx:RemoteObject id="utilityUCFlexRO" destination="utilityUCFlex RO">
<mx:method name="updateStationDetails " result="updateStationResul t(event)" fault="updateStationFault( event)"/>
</mx:RemoteObject>
<mx:RemoteObject id="branchDetailsUCFlexRO" destination="branchDetails UCFlexRO">
<mx:method name="getBranchList" result="handleBranchListRe sult(event )" fault="handleBranchListFau lt(event)" />
</mx:RemoteObject>
<mx:RemoteObject id="accountOpenUCFlexRO" destination="accountOpenUC FlexRO">
<mx:method name="getProdId" result="handleProdIdResult (event)" fault="handleProdIdFault(e vent)"/>
<mx:method name="getTitleCodes" result="handleTitleCodesRe sult(event )" fault="handleTitleCodesFau lt(event)" />
</mx:RemoteObject>
<mx:RemoteObject id="accountModifyUCFlexRO" destination="accountModify UCFlexRO">
<mx:method name="getUimRecord" result="handleUimRecordRes ult(event) " fault="handleUimRecordFaul t(event)"/ >
<mx:method name="getAcHolderNameAndTi tle" result="handleAcHolderDeta ilsResult( event)" fault="handleAcHolderDetai lsFault(ev ent)"/>
<mx:method name="modifyNameDetails" result="handleModifyNameDe tailsResul t(event)" fault="handleModifyNameDet ailsFault( event)"/>
</mx:RemoteObject>
<mx:Script>
<![CDATA[
import com.citizen.cbs.CitizenApp lication;
import com.citizen.cbs.model.Code Ebank;
import com.citizen.cbs.model.Code Gl;
import com.citizen.cbs.model.Code Title;
import com.citizen.cbs.model.Uniq ueIdMaster ;
import mx.collections.ArrayCollec tion;
import mx.controls.Alert;
import mx.core.Application;
import mx.events.CloseEvent;
import mx.events.DataGridEvent;
import mx.events.ListEvent;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
[Bindable]
private var attemptNo:int=0;
[Bindable]
private var branchCodes:ArrayCollectio n=new ArrayCollection();
[Bindable]
private var prodCodes:ArrayCollection= new ArrayCollection();
[Bindable]
public var titleCodes:ArrayCollection =new ArrayCollection();
[Bindable]
private var progmode:String=null;
[Bindable]
public var branch:int;
[Bindable]
public var branch1:int;
[Bindable]
public var productId:int;
[Bindable]
private var uniqueIdMaster:UniqueIdMas ter;
[Bindable]
private var accountHolders:ArrayCollec tion = new ArrayCollection();
[Bindable]
private var particularDetails:ArrayCol lection = new ArrayCollection();
[Bindable]
private var custId:int=0;
[Bindable]
private var acHolderDetails:ArrayColle ction = new ArrayCollection();
[Bindable]
private var tableData:ArrayCollection = new ArrayCollection();
[Bindable]
private var acname:String = null;
[Bindable]
private var titleArray:ArrayCollection = new ArrayCollection();
private function btnCancelClicked():void
{
utilityUCFlexRO.updateStat ionDetails ("MM0000") ;
}
private function btnResetClicked():void
{
hlSearch.enabled = true;
cmbProdId.enabled = true;
txtAcNo.enabled = true;
btnOK.enabled = false;
cmbProdId.selectedIndex=0;
txtAcNo.text=null;
accountHolders = new ArrayCollection();
titleArray = new ArrayCollection();
}
private function initApp():void
{
utilityUCFlexRO.updateStat ionDetails (CitizenAp plication. menuParame ters["modu lecode"]);
}
private function updateStationResult(event: ResultEven t):void
{
attemptNo=attemptNo+1;
if(attemptNo>1)
{
Application.application.un loadModule ();
}
}
private function updateStationFault(event:F aultEvent) :void
{
Alert.show("in update station fault : "+event.fault.faultString+ " ");
}
private function onCreationComplete():void
{
branchDetailsUCFlexRO.getB ranchList( );
progmode=CitizenApplicatio n.menuPara meters["ac tion"];
if(progmode == "Modify")
{
btnOK.enabled=false;
}
}
private function handleBranchListResult(eve nt:ResultE vent):void
{
branchCodes = ArrayCollection(event.resu lt);
branch1 = branchCodes.getItemAt(0).b dBranchNo;
branch = branchCodes.getItemAt(0).b dBranchNo;
if(branch1==400209001)
{
cmbBranch.visible=true;
lblBranch.visible=true;
}
else
{
var c:CodeEbank = new CodeEbank();
c.cebMicr=branch;
cmbBranch.selectedIndex= 0;
cmbBranch.visible=true;
lblBranch.visible=true;
cmbBranch.enabled=false;
}
accountOpenUCFlexRO.getPro dId();
}
private function handleBranchListFault(even t:FaultEve nt):void
{
Alert.show("in branch read fault : "+event.fault.faultString+ " ");
}
private function handleProdIdResult(event:R esultEvent ):void
{
prodCodes=ArrayCollection( event.resu lt);
accountOpenUCFlexRO.getTit leCodes();
}
private function handleProdIdFault(event:Fa ultEvent): void
{
Alert.show("in prod id fault"+event.fault.faultSt ring+" ");
}
private function handleTitleCodesResult(eve nt:ResultE vent):void
{
titleCodes=ArrayCollection (event.res ult);
}
private function handleTitleCodesFault(even t:FaultEve nt):void
{
Alert.show("title fault"+event.fault.faultSt ring+" ");
}
private function hlSearchDetailsClicked():v oid
{
if(cmbProdId.selectedItem= =null || CodeGl(cmbProdId.selectedI tem).cglCo de==0)
{
Alert.show("Please Select the Product ID");
}
else
{
if(txtAcNo.text ==null || txtAcNo.text=="")
{
Alert.show("Please Enter the Account No.");
}
else
{
productId=CodeGl(cmbProdId .selectedI tem).cglCo de;
var prodId:int=CodeGl(cmbProdI d.selected Item).cglC ode;
var acNo:int=Number(txtAcNo.te xt);
accountModifyUCFlexRO.getU imRecord(b ranch,prod Id,acNo,pr ogmode);
}
}
}
private function handleUimRecordResult(even t:ResultEv ent):void
{
this.uniqueIdMaster=Unique IdMaster(e vent.resul t);
if(!(uniqueIdMaster==null) )
{
custId=uniqueIdMaster.id.u imCustomer Id;
hlSearch.enabled = false;
cmbProdId.enabled = false;
txtAcNo.enabled = false;
accountModifyUCFlexRO.getA cHolderNam eAndTitle( branch,Cod eGl(cmbPro dId.select edItem).cg lCode,Numb er(txtAcNo .text),cus tId);
}
}
private function handleUimRecordFault(event :FaultEven t):void
{
Alert.show("uim fault : "+event.fault.faultString) ;
}
private function handleAcHolderDetailsResul t(event:Re sultEvent) :void
{
acHolderDetails = ArrayCollection(event.resu lt);
if(productId == 101 || productId == 102 || productId == 103)
{
for(var i:int = 0 ; i < acHolderDetails.length; i++)
{
titleArray.addItemAt({name :acHolderD etails.get ItemAt(i). samName,
title:acHolderDetails.getI temAt(i).c odeTitle.c tCode},i);
}
}
else if(productId == 104)
{
Alert.show("acHolderDetail s: "+acHolderDetails.length);
for(var i:int = 0 ; i < acHolderDetails.length; i++)
{
titleArray.addItemAt({name :acHolderD etails.get ItemAt(i). camName,
title:acHolderDetails.getI temAt(i).c odeTitle.c tCode},i);
}
}
else if(productId.toString().ch arAt(0)==" 4")
{
for(var i:int = 0 ; i < acHolderDetails.length; i++)
{
titleArray.addItemAt({name :acHolderD etails.get ItemAt(i). tamName,
title:acHolderDetails.getI temAt(i).c odeTitle.c tCode},i);
}
}
btnOK.enabled = true;
}
private function handleAcHolderDetailsFault (event:Fau ltEvent):v oid
{
Alert.show("Ac Holder Details Fault : "+event.fault.faultString+ " ");
}
private function okClicked():void
{
Alert.show("Name: "+titleArray.getItemAt(0). name);
Alert.show("Title: "+titleArray.getItemAt(0). title);
Alert.show("Title Array: "+titleArray.length);
}
private function handleModifyNameDetailsRes ult(event: ResultEven t):void
{
Alert.show(event.result.to String());
btnResetClicked();
}
private function handleModifyNameDetailsFau lt(event:F aultEvent) :void
{
Alert.show("modifyAccNameD etailsFaul t : "+event.fault.faultString+ " ");
}
public function UpdateEditFlag(evt:DataGri dEvent):vo id
{
Alert.show("In UpdateEditFlag");
var row:int = evt.rowIndex;
var col:int = evt.columnIndex;
var dg:DataGrid = evt.currentTarget as DataGrid;
// Get dataprovider
var data:ArrayCollection = dg.dataProvider as ArrayCollection;
var cObj:Object = data.getItemAt(row);
// get updated value
var textFld:TextInput = (DataGrid(evt.target).item EditorInst ance) as TextInput;
// cols
var cols:Array= dg.columns;
// edited column
var ccol:DataGridColumn = cols[col] as DataGridColumn;
cObj.edited = "Edited" + ccol.dataField + "[" + row + "]["+col+"]";
Alert.show("Updated");
}
]]>
</mx:Script>
<index:GetIndex id="getIndex"/>
<mx:Panel x="0" y="0" layout="absolute" title="A/c Holder's Name Modify">
<mx:VBox>
<mx:Spacer height="10"/>
<mx:HBox x="0" y="10" horizontalAlign="center" verticalAlign="middle">
<mx:Spacer width="15"/>
<mx:Label text="Branch:" id="lblBranch"/>
<mx:ComboBox id="cmbBranch" dataProvider="{branchCodes }" labelField="bdBranchName"/ >
<mx:Spacer width="10"/>
<mx:Label text="Product ID:"/>
<mx:ComboBox id="cmbProdId" dataProvider="{prodCodes}" labelField="cglDesc"/>
<mx:Spacer width="10"/>
<mx:Label text="Account No.:"/>
<mx:TextInput width="100" id="txtAcNo" restrict="0-9"/>
<mx:Spacer width="10"/>
<mx:LinkButton label="Search" id="hlSearch" click="hlSearchDetailsClic ked()"/>
<mx:Spacer width="15"/>
</mx:HBox>
<mx:Spacer height="20"/>
<mx:DataGrid x="0" y="61" width="100%" dataProvider="{titleArray} " id="dg1" >
<mx:columns>
<mx:DataGridColumn width="100" id="dgc1" rendererIsEditor="true" headerText="Title" editable="true"
editorDataField="value" dataField="title">
<mx:itemRenderer>
<mx:Component>
<customcomponents:GridComb oBox dataProvider="{parentDocum ent.titleC odes}"
labelField="ctDesc" lookupField="ctCode"
color="#000000" change="dispatchEvent(new mx.events.DataGridEvent(mx .events.Da taGridEven t.ITEM_FOC US_OUT, true, true));"/>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn headerText="Name" id="dgc2" editable="true" dataField="name" editorDataField="text">
<mx:itemRenderer>
<mx:Component>
<mx:TextInput restrict="A-Z a-z" maxChars="50" editable="true" />
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
<mx:Spacer height="20"/>
</mx:VBox>
<mx:ControlBar y="289" height="59">
<mx:Button label="OK" width="80" id="btnOK" click="okClicked()"/>
<mx:Button label="RESET" width="80" id="btnReset" click="btnResetClicked()"/ >
<mx:Button label="CANCEL" width="80" id="btnCancel" click="btnCancelClicked()" />
</mx:ControlBar>
</mx:Panel>
</mx:Module>
<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:model="com.citizen.c
xmlns:index="com.citizen.c
creationComplete="onCreati
layout="absolute" xmlns:customcomponents="co
<mx:RemoteObject id="utilityUCFlexRO" destination="utilityUCFlex
<mx:method name="updateStationDetails
</mx:RemoteObject>
<mx:RemoteObject id="branchDetailsUCFlexRO"
<mx:method name="getBranchList" result="handleBranchListRe
</mx:RemoteObject>
<mx:RemoteObject id="accountOpenUCFlexRO" destination="accountOpenUC
<mx:method name="getProdId" result="handleProdIdResult
<mx:method name="getTitleCodes" result="handleTitleCodesRe
</mx:RemoteObject>
<mx:RemoteObject id="accountModifyUCFlexRO"
<mx:method name="getUimRecord" result="handleUimRecordRes
<mx:method name="getAcHolderNameAndTi
<mx:method name="modifyNameDetails" result="handleModifyNameDe
</mx:RemoteObject>
<mx:Script>
<![CDATA[
import com.citizen.cbs.CitizenApp
import com.citizen.cbs.model.Code
import com.citizen.cbs.model.Code
import com.citizen.cbs.model.Code
import com.citizen.cbs.model.Uniq
import mx.collections.ArrayCollec
import mx.controls.Alert;
import mx.core.Application;
import mx.events.CloseEvent;
import mx.events.DataGridEvent;
import mx.events.ListEvent;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
[Bindable]
private var attemptNo:int=0;
[Bindable]
private var branchCodes:ArrayCollectio
[Bindable]
private var prodCodes:ArrayCollection=
[Bindable]
public var titleCodes:ArrayCollection
[Bindable]
private var progmode:String=null;
[Bindable]
public var branch:int;
[Bindable]
public var branch1:int;
[Bindable]
public var productId:int;
[Bindable]
private var uniqueIdMaster:UniqueIdMas
[Bindable]
private var accountHolders:ArrayCollec
[Bindable]
private var particularDetails:ArrayCol
[Bindable]
private var custId:int=0;
[Bindable]
private var acHolderDetails:ArrayColle
[Bindable]
private var tableData:ArrayCollection = new ArrayCollection();
[Bindable]
private var acname:String = null;
[Bindable]
private var titleArray:ArrayCollection
private function btnCancelClicked():void
{
utilityUCFlexRO.updateStat
}
private function btnResetClicked():void
{
hlSearch.enabled = true;
cmbProdId.enabled = true;
txtAcNo.enabled = true;
btnOK.enabled = false;
cmbProdId.selectedIndex=0;
txtAcNo.text=null;
accountHolders = new ArrayCollection();
titleArray = new ArrayCollection();
}
private function initApp():void
{
utilityUCFlexRO.updateStat
}
private function updateStationResult(event:
{
attemptNo=attemptNo+1;
if(attemptNo>1)
{
Application.application.un
}
}
private function updateStationFault(event:F
{
Alert.show("in update station fault : "+event.fault.faultString+
}
private function onCreationComplete():void
{
branchDetailsUCFlexRO.getB
progmode=CitizenApplicatio
if(progmode == "Modify")
{
btnOK.enabled=false;
}
}
private function handleBranchListResult(eve
{
branchCodes = ArrayCollection(event.resu
branch1 = branchCodes.getItemAt(0).b
branch = branchCodes.getItemAt(0).b
if(branch1==400209001)
{
cmbBranch.visible=true;
lblBranch.visible=true;
}
else
{
var c:CodeEbank = new CodeEbank();
c.cebMicr=branch;
cmbBranch.selectedIndex= 0;
cmbBranch.visible=true;
lblBranch.visible=true;
cmbBranch.enabled=false;
}
accountOpenUCFlexRO.getPro
}
private function handleBranchListFault(even
{
Alert.show("in branch read fault : "+event.fault.faultString+
}
private function handleProdIdResult(event:R
{
prodCodes=ArrayCollection(
accountOpenUCFlexRO.getTit
}
private function handleProdIdFault(event:Fa
{
Alert.show("in prod id fault"+event.fault.faultSt
}
private function handleTitleCodesResult(eve
{
titleCodes=ArrayCollection
}
private function handleTitleCodesFault(even
{
Alert.show("title fault"+event.fault.faultSt
}
private function hlSearchDetailsClicked():v
{
if(cmbProdId.selectedItem=
{
Alert.show("Please Select the Product ID");
}
else
{
if(txtAcNo.text ==null || txtAcNo.text=="")
{
Alert.show("Please Enter the Account No.");
}
else
{
productId=CodeGl(cmbProdId
var prodId:int=CodeGl(cmbProdI
var acNo:int=Number(txtAcNo.te
accountModifyUCFlexRO.getU
}
}
}
private function handleUimRecordResult(even
{
this.uniqueIdMaster=Unique
if(!(uniqueIdMaster==null)
{
custId=uniqueIdMaster.id.u
hlSearch.enabled = false;
cmbProdId.enabled = false;
txtAcNo.enabled = false;
accountModifyUCFlexRO.getA
}
}
private function handleUimRecordFault(event
{
Alert.show("uim fault : "+event.fault.faultString)
}
private function handleAcHolderDetailsResul
{
acHolderDetails = ArrayCollection(event.resu
if(productId == 101 || productId == 102 || productId == 103)
{
for(var i:int = 0 ; i < acHolderDetails.length; i++)
{
titleArray.addItemAt({name
title:acHolderDetails.getI
}
}
else if(productId == 104)
{
Alert.show("acHolderDetail
for(var i:int = 0 ; i < acHolderDetails.length; i++)
{
titleArray.addItemAt({name
title:acHolderDetails.getI
}
}
else if(productId.toString().ch
{
for(var i:int = 0 ; i < acHolderDetails.length; i++)
{
titleArray.addItemAt({name
title:acHolderDetails.getI
}
}
btnOK.enabled = true;
}
private function handleAcHolderDetailsFault
{
Alert.show("Ac Holder Details Fault : "+event.fault.faultString+
}
private function okClicked():void
{
Alert.show("Name: "+titleArray.getItemAt(0).
Alert.show("Title: "+titleArray.getItemAt(0).
Alert.show("Title Array: "+titleArray.length);
}
private function handleModifyNameDetailsRes
{
Alert.show(event.result.to
btnResetClicked();
}
private function handleModifyNameDetailsFau
{
Alert.show("modifyAccNameD
}
public function UpdateEditFlag(evt:DataGri
{
Alert.show("In UpdateEditFlag");
var row:int = evt.rowIndex;
var col:int = evt.columnIndex;
var dg:DataGrid = evt.currentTarget as DataGrid;
// Get dataprovider
var data:ArrayCollection = dg.dataProvider as ArrayCollection;
var cObj:Object = data.getItemAt(row);
// get updated value
var textFld:TextInput = (DataGrid(evt.target).item
// cols
var cols:Array= dg.columns;
// edited column
var ccol:DataGridColumn = cols[col] as DataGridColumn;
cObj.edited = "Edited" + ccol.dataField + "[" + row + "]["+col+"]";
Alert.show("Updated");
}
]]>
</mx:Script>
<index:GetIndex id="getIndex"/>
<mx:Panel x="0" y="0" layout="absolute" title="A/c Holder's Name Modify">
<mx:VBox>
<mx:Spacer height="10"/>
<mx:HBox x="0" y="10" horizontalAlign="center" verticalAlign="middle">
<mx:Spacer width="15"/>
<mx:Label text="Branch:" id="lblBranch"/>
<mx:ComboBox id="cmbBranch" dataProvider="{branchCodes
<mx:Spacer width="10"/>
<mx:Label text="Product ID:"/>
<mx:ComboBox id="cmbProdId" dataProvider="{prodCodes}"
<mx:Spacer width="10"/>
<mx:Label text="Account No.:"/>
<mx:TextInput width="100" id="txtAcNo" restrict="0-9"/>
<mx:Spacer width="10"/>
<mx:LinkButton label="Search" id="hlSearch" click="hlSearchDetailsClic
<mx:Spacer width="15"/>
</mx:HBox>
<mx:Spacer height="20"/>
<mx:DataGrid x="0" y="61" width="100%" dataProvider="{titleArray}
<mx:columns>
<mx:DataGridColumn width="100" id="dgc1" rendererIsEditor="true" headerText="Title" editable="true"
editorDataField="value" dataField="title">
<mx:itemRenderer>
<mx:Component>
<customcomponents:GridComb
labelField="ctDesc" lookupField="ctCode"
color="#000000" change="dispatchEvent(new mx.events.DataGridEvent(mx
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn headerText="Name" id="dgc2" editable="true" dataField="name" editorDataField="text">
<mx:itemRenderer>
<mx:Component>
<mx:TextInput restrict="A-Z a-z" maxChars="50" editable="true" />
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
<mx:Spacer height="20"/>
</mx:VBox>
<mx:ControlBar y="289" height="59">
<mx:Button label="OK" width="80" id="btnOK" click="okClicked()"/>
<mx:Button label="RESET" width="80" id="btnReset" click="btnResetClicked()"/
<mx:Button label="CANCEL" width="80" id="btnCancel" click="btnCancelClicked()"
</mx:ControlBar>
</mx:Panel>
</mx:Module>
ASKER
<?xml version="1.0" encoding="utf-8"?>
<mx:Application tabEnabled="false" tabChildren="true" xmlns:mx="http://www.adobe.com/2006/mxml" initialize="init()"
applicationComplete="regis terGlobalK eyHandler( )" layout="absolute" width="100%" height="100%"
xmlns:model="com.citizen.c bs.model.* " xmlns:utils="flexed.utils. timeout.*" >
<utils:ClientIdleTimeOut id="myTimeOut" onTimeOut="onTimeOutHandle r" listenKeyStroke="true" listenMouseMove="true"
timeOutInterval="5" confirmInterval="5"/>
<model:BranchDetails id="branchDetailsVO"/>
<mx:XML id="mainMenu" source="/assets/xml/mainme nu.xml" format="xml"/>
<mx:DateFormatter id="df" formatString="DD-MM-YYYY" />
<mx:ApplicationControlBar horizontalAlign="center" width="90%" x="60" y="0">
<!--<mx:MenuBar dataProvider="{mainMenu}" labelField="@label" showRoot="false" itemClick="loadModule(even t.item)" />-->
<mx:Label text="Ver.No.: R1663" fontWeight="bold" fontSize="12" color="#000000"/>
<mx:Label text="Station No.:" color="#000000" fontFamily="san" fontWeight="bold"/>
<mx:Label text="--" color="#000000" id="lblStn" fontFamily="san" fontWeight="bold"/>
<!--<mx:MenuBar dataProvider="{mainMenu}" labelField="@label" showRoot="false" itemClick="loadModule(even t.item)" />-->
<mx:Spacer width="100%" />
<mx:Text fontWeight="bold" text="{CitizenApplication. initInfo.r egisteredU ser.branch Details.bd BankName}" styleName="appctrl"/>
<mx:Text fontWeight="bold" text="-" styleName="appctrl"/>
<mx:Text fontWeight="bold" text="{CitizenApplication. initInfo.r egisteredU ser.branch Details.bd BranchName .toUpperCa se()}" styleName="appctrl"/>
<mx:Text fontWeight="bold" text="BRANCH" styleName="appctrl"/>
<mx:Spacer width="100%" />
<mx:Text fontWeight="bold" text="{CitizenApplication. initInfo.r egisteredU ser.uamNam e}" styleName="appctrl"/>
<mx:Text fontWeight="bold" text="|" styleName="appctrl"/>
<mx:Text fontWeight="bold" text="{df.format(CitizenAp plication. initInfo.r egisteredU ser.branch Details.bd CurrentWor kingDt)}" styleName="appctrl"/>
</mx:ApplicationControlBar >
<mx:HDividedBox id="divBox" width="100%" height="100%" shadowDirection="center" resizeToContent="true" liveDragging="true" horizontalGap="10" x="0" y="34">
<mx:VBox width="274" id="treeBox" borderStyle="solid" borderColor="#6699CC"><mx: Tree backgroundColor="#000000" color="#FFFFFF" width="100%" height="100%" id="treeMenu" dataProvider="{mainMenu}" labelField="@label" showRoot="false"
itemClick="loadModule(tree Menu.selec tedItem)"/ >
<!--<mx:Tree backgroundColor="#000000" color="#FFFFFF" width="100%" height="100%" id="treeMenu" dataProvider="{XMLDocument }" labelField="@label" showRoot="false"
itemClick="loadModule(tree Menu.selec tedItem)"/ >-->
</mx:VBox>
<mx:Canvas id="moduleCanvas" width="100%" height="100%" styleName="mmc">
<mx:ModuleLoader backgroundColor="#000000" color="#FFFFFF" error="handleModuleLoaderE rror(event )"
updateComplete="treeMenu.h eight = moduleCanvas.height-2" loading="CursorManager.set BusyCursor ()"
useHandCursor="true" ready="CursorManager.remov eBusyCurso r()" autoLayout="true"
verticalAlign="middle" horizontalAlign="center" id="formLoader" width="100%" height="100%" />
</mx:Canvas>
</mx:HDividedBox>
<mx:Style source="CbsDesignFinal.css "/>
</mx:Application>
<mx:Application tabEnabled="false" tabChildren="true" xmlns:mx="http://www.adobe.com/2006/mxml" initialize="init()"
applicationComplete="regis
xmlns:model="com.citizen.c
<utils:ClientIdleTimeOut id="myTimeOut" onTimeOut="onTimeOutHandle
timeOutInterval="5" confirmInterval="5"/>
<model:BranchDetails id="branchDetailsVO"/>
<mx:XML id="mainMenu" source="/assets/xml/mainme
<mx:DateFormatter id="df" formatString="DD-MM-YYYY" />
<mx:ApplicationControlBar horizontalAlign="center" width="90%" x="60" y="0">
<!--<mx:MenuBar dataProvider="{mainMenu}" labelField="@label" showRoot="false" itemClick="loadModule(even
<mx:Label text="Ver.No.: R1663" fontWeight="bold" fontSize="12" color="#000000"/>
<mx:Label text="Station No.:" color="#000000" fontFamily="san" fontWeight="bold"/>
<mx:Label text="--" color="#000000" id="lblStn" fontFamily="san" fontWeight="bold"/>
<!--<mx:MenuBar dataProvider="{mainMenu}" labelField="@label" showRoot="false" itemClick="loadModule(even
<mx:Spacer width="100%" />
<mx:Text fontWeight="bold" text="{CitizenApplication.
<mx:Text fontWeight="bold" text="-" styleName="appctrl"/>
<mx:Text fontWeight="bold" text="{CitizenApplication.
<mx:Text fontWeight="bold" text="BRANCH" styleName="appctrl"/>
<mx:Spacer width="100%" />
<mx:Text fontWeight="bold" text="{CitizenApplication.
<mx:Text fontWeight="bold" text="|" styleName="appctrl"/>
<mx:Text fontWeight="bold" text="{df.format(CitizenAp
</mx:ApplicationControlBar
<mx:HDividedBox id="divBox" width="100%" height="100%" shadowDirection="center" resizeToContent="true" liveDragging="true" horizontalGap="10" x="0" y="34">
<mx:VBox width="274" id="treeBox" borderStyle="solid" borderColor="#6699CC"><mx:
itemClick="loadModule(tree
<!--<mx:Tree backgroundColor="#000000" color="#FFFFFF" width="100%" height="100%" id="treeMenu" dataProvider="{XMLDocument
itemClick="loadModule(tree
</mx:VBox>
<mx:Canvas id="moduleCanvas" width="100%" height="100%" styleName="mmc">
<mx:ModuleLoader backgroundColor="#000000" color="#FFFFFF" error="handleModuleLoaderE
updateComplete="treeMenu.h
useHandCursor="true" ready="CursorManager.remov
verticalAlign="middle" horizontalAlign="center" id="formLoader" width="100%" height="100%" />
</mx:Canvas>
</mx:HDividedBox>
<mx:Style source="CbsDesignFinal.css
</mx:Application>
I your are trying to do?
Is this related to your original question?
Is this related to your original question?
ASKER
Yes....VikyMad wanted me to post the code.....i need a change event on the text input component that dynamically updates the dataprovider.....I have done the same for the combobox....but unable to do so for the text input...
<mx:DataGrid x="0" y="61" width="100%" dataProvider="{titleArray}" id="dg1" >
<mx:columns>
<mx:DataGridColumn width="100" id="dgc1" rendererIsEditor="true" headerText="Title" editable="true"
editorDataField="value" dataField="title">
<mx:itemRenderer>
<mx:Component>
<customcomponents:GridComboBox dataProvider="{parentDocument.titleCodes}"
labelField="ctDesc" lookupField="ctCode"
color="#000000" change="dispatchEvent(new mx.events.DataGridEvent(mx.events.DataGridEvent.ITEM_FOCUS_OUT, true, true));"/> //This change event updates the dataprovider
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn headerText="Name" id="dgc2" editable="true" dataField="name" editorDataField="text">
<mx:itemRenderer>
<mx:Component>
<mx:TextInput restrict="A-Z a-z" maxChars="50" editable="true" /> //Here is where I require the change event
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
I think you can find an answer here
https://www.experts-exchange.com/questions/27085995/how-to-use-DataGridEvent-ITEM-EDIT-END.html
https://www.experts-exchange.com/questions/27085995/how-to-use-DataGridEvent-ITEM-EDIT-END.html
ASKER
But Y doesn't the same change event for the GridCombBox work but the same event for the TextInput gives me an error: Error Msg: 1120: Access of undefined property mx.
Where is this error?
ASKER
the error comes up when i use the same change event for text input component.....
ASKER
ddd
Look at one of my accepted answer.
https://www.experts-exchange.com/questions/27082016/How-to-save-the-edited-data-in-datagrid.html
"itemEditEnd" attribute and releated code.