Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jun 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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>

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,638
    Thanks
    2
    Thanked 404 Times in 396 Posts
    Where would the values be coming from?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •