Go Back   CodingForums.com > :: Client side development > Flash & ActionScript > Adobe Flex

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-17-2010, 04:58 PM   PM User | #1
KoolFlex
New to the CF scene

 
Join Date: Jun 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
KoolFlex is an unknown quantity at this point
DataProviding to a particular DataGrid Column

Hi,

I have three columns in my Datagrid, in which I'm providing data for first two columns through XML / Webservice (I'm retrieving data from a database).

The database table does not have values to be passed to the third column, so I am trying to pass values to this particular column, how is it possible to do this?

Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml"   borderColor="#587498" width="600" height="500"  xmlns:test="n2.test.*"  xmlns:ns1="n2.test.*" xmlns:custom="n2.WFU.components.*">
<mx:Script>
		<![CDATA[
			import mx.collections.XMLListCollection;
			import mx.core.Application;
            import mx.rpc.events.ResultEvent;
			
		import mx.events.ListEvent;
		import mx.events.DataGridEvent;
		import mx.controls.Alert;
		import mx.collections.ArrayCollection;
		import n2.test.TestDataLoader;
		import mx.controls.CheckBox;
		import n2.vo.*;
		
		private function InstituteSearch():void
			{
				var studentlist:Array=new Array();
				studentlist=TestDataLoader.InstutesList.source;
				TestDataLoader.MatchingInstitution.removeAll();
				var isAdd:Boolean =true;
				for each (var item3:Object in studentlist)
				{
					if(txtInstitution.text != "")
					{
						if(item3["Instution"].toString().indexOf(txtInstitution.text) > -1)
						{
							if(isAdd)
							{ 
							TestDataLoader.MatchingInstitution.addItem(item3);
							isAdd=false;
							}
						}
					}
					isAdd = true;
				}
			}
		
		private function UpdateData()
		{
			var item1:Object = dgTransactions.selectedItem;	
			Application.application.studentDetails.Instution.text = dgTransactions.selectedItem.Instution;
			Application.application.studentDetails.Internal.text = dgTransactions.selectedItem.Inner;
			Application.application.studentDetails.Ipdes.text = dgTransactions.selectedItem.Iped;
			//Alert.show("updated successfully");
			_xmlResult=null;
			this.visible  =false;
		}
		private function close():void{
			_xmlResult=null;
			//_xmlResult.INSTQueryServiceData=null;
			
			this.visible=false;
		}

[Bindable]private var _xmlResult:XML;      //holds the result xml
private var result:XML;
  [Bindable]private var _xlDayData:XMLList;  //dataProvider for the day weather dataGrid
  [Bindable]private var _sPlace:String;
   [Bindable]private var val:ArrayCollection;
 public  var dataGridDataProvider:ArrayCollection=new ArrayCollection();

  private function clickHandler():void
     {
        userRequest.INSTITUTIONQueryService.send(txtInstitution.text);
        _xmlResult=null;
		_xmlResult.INSTITUTIONQueryServiceData=null;
		dgTransactions.dataProvider=_xmlResult.INSTITUTIONQueryServiceData;
	}
	
private function getValue(e:ResultEvent):void 
{
	 _xmlResult = XML(e.result);
	// result=_xmlResult.INSTQueryServiceData;
	 Alert.show("Result :"+_xmlResult.toString());
	 	dgTransactions.dataProvider=_xmlResult.INSTITUTIONQueryServiceData;
	 	}
	 	 private function resetAll():void{
	 txtInstitution.text='';
		 }
	/*for(var i:int = 0; i <_xmlResult.InstituteDetails.InstituteDetailValues.length(); i++) {
     	var insti:String=_xmlResult.InstituteDetails.InstituteDetailValues[i].institute;
     	var icode:String=_xmlResult.InstituteDetails.InstituteDetailValues[i].instituteCode;
     	var iped:String=_xmlResult.InstituteDetails.InstituteDetailValues[i].ipedCode;
    dataGridDataProvider.addItem(new InstituteLookupGrid(insti,icode,iped));
}
dgTransactions.dataProvider=dataGridDataProvider;	
} */
		]]>
	</mx:Script>
	<mx:WebService id="userRequest"  showBusyCursor="true" wsdl="http://kavin-pc:8080/InstiServ/services/INSTITUTIONWSDLFile?wsdl">
      <mx:operation name="INSTITUTIONQueryService"  resultFormat="xml" result="getValue(event);" fault="mx.controls.Alert.show(event.fault.faultString)"/>
</mx:WebService>


	<mx:VBox width="100%">
		
	
	<mx:Text width="100%" text="Select Institute" fontWeight="bold"/>
	<mx:Form width="100%" paddingLeft="0" paddingBottom="0" paddingRight="0" paddingTop="0">
		
		<mx:FormItem width="100%" direction="vertical" label="Institution">
			<mx:TextInput id="txtInstitution" maxChars="45">
			</mx:TextInput>
		</mx:FormItem>
		
		<mx:FormItem>
			<mx:Button label="Find" id="Find" click="clickHandler()"/>
		</mx:FormItem>
		
	</mx:Form>
	<mx:ControlBar width="100%">
		<mx:DataGrid id="dgTransactions" width="100%" 
			 height="100%" x="0" dataProvider="{_xmlResult.INSTITUTIONQueryServiceData}">
            <mx:columns>
                <mx:DataGridColumn dataField="InstitutionName" headerText="Institue" width="90" headerWordWrap="true" wordWrap="true"/>
                <mx:DataGridColumn dataField="InstitutionErpCode" headerText="Internal Code"  color="#000000" width="90" headerWordWrap="true" wordWrap="true"/>
             <mx:DataGridColumn dataField="IpedsCode" headerText="IPED Code" color="#000000" width="90" headerWordWrap="true" wordWrap="true"/>
                       	
              </mx:columns>
        </mx:DataGrid>
			</mx:ControlBar>
			<mx:HBox>
					<mx:Button label="Submit" id="submitbutton" click="UpdateData()"/>
					<mx:Button label="Close"  click="close()"/>
			</mx:HBox>
		
			</mx:VBox>
</mx:Panel>
KoolFlex is offline   Reply With Quote
Old 06-18-2010, 02:20 PM   PM User | #2
Inigoesdr
Super Moderator


 
Inigoesdr's Avatar
 
Join Date: Mar 2007
Location: Florida, USA
Posts: 3,601
Thanks: 2
Thanked 397 Times in 390 Posts
Inigoesdr is a jewel in the roughInigoesdr is a jewel in the roughInigoesdr is a jewel in the rough
Where would the values be coming from?
Inigoesdr is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:10 PM.


Advertisement
Log in to turn off these ads.