I am returning a query from a CFC to a datagrid and I get extra blank rows in 
the datagrid.  I don't see a rhyme or reason for the number of extra rows 
either.  Some queries return 5 records with 3 extra rows and some return 4 
records with 3 extra rows.  I double checked the query and it does not return 
any blank records.

Is there a better way of populating the datagrid?

Here is my code that is taking the returned query and populating the datagrid.


private function submitJob():void {
        roGetJobs.getJob();
}

private function onGetJobResult(re:ResultEvent):void {
   dgJob.dataProvider = ArrayCollection(re.result); 
}

private function onGetJobFault(fe:FaultEvent):void {
   Alert.show(fe.fault.message);
}

<mx:RemoteObject id="roGetJobs" destination="ColdFusion" source="com.login"
        endpoint="http://localhost/flex2gateway/"; 
        result="onGetJobResult(event)" fault="onGetJobFault(event)"> 
    <mx:method name="getJob">
        <mx:arguments>
            <jobNum>{jobNum.text}</jobNum>
        </mx:arguments>
    </mx:method>
</mx:RemoteObject>


<mx:TextInput x="94" y="204" id="jobNum"/>
<mx:Button x="119" y="234" label="Get Job" click="submitJob()" 
id="getJobButton"/>
        
<mx:DataGrid id="dgJob" x="10" y="264" width="100%">
        <mx:columns>
                <mx:DataGridColumn headerText="Job Number" dataField="JobNum"/>
                <mx:DataGridColumn headerText="Job Name" dataField="JobName"/>
                <mx:DataGridColumn headerText="Job Description" 
dataField="JobDescription"/>
                <mx:DataGridColumn headerText="Job Ticket ID" 
dataField="JobTicketID"/>
        </mx:columns>
</mx:DataGrid>


Here is the CFC function:
<cffunction name="getJob" returnType="query" output="no" access="remote">
        <cfargument name="jobNum" type="numeric" required="yes">
        <cfset var getJobInfo = "">

        <cfquery datasource="data" name="getJobInfo">
        SELECT Job.JobNum, Job.JobName, job.JobDescription, 
JobTicket.JobTicketID
        FROM Job, JobTicket
        WHERE job.JobNum = #arguments.jobNum# AND Job.JobNum = JobTicket.Jobnum
        </cfquery>
                        
        <cfreturn getJobInfo>
</cffunction>

Reply via email to