Skip navigation
re-Flexing
Currently Being Moderated

datagrid won't display anything

Aug 13, 2009 4:44 AM

Hi I'm new in flex, I think my datas are already displayed in my datagrid because there is already a scroll bar in my datagrid only, it is not visible. I haven't set it as visible="false". If you want to clearly understand my question, I've uploaded the screenshot of my datagrid. (I can't clearly state my question properly because I'm having a hard time in speaking in English, I'm not an American..)

 

I will just show you my code..:D


(mxml code)

 

<mx:DataGrid width="584" height="172" horizontalCenter="0" verticalCenter="1" id="dgcandidate" dataProvider="{cangrid.lastResult.datas.data}" creationComplete="cangrid.send()">
                                <mx:columns>
                                    <mx:DataGridColumn headerText="canid" dataField="id1" visible="false"/>
                                    <mx:DataGridColumn headerText="Last Name" dataField="ln1"/>
                                    <mx:DataGridColumn headerText="First Name" dataField="fn1"/>
                                    <mx:DataGridColumn headerText="Year" dataField="yr1"/>
                                    <mx:DataGridColumn headerText="Course" dataField="kurs1"/>
                                    <mx:DataGridColumn headerText="Position" dataField="pos1"/>
                                </mx:columns>
                            </mx:DataGrid>

 

<mx:HTTPService id="cangrid" url="cangrid.php" useProxy="false" showBusyCursor="false" method="POST">
    <mx:request xmlns="">
    </mx:request>
</mx:HTTPService>

 

this is my php code  in connecting with my flex (cangrid.php)

 

$query  = "SELECT candidate.candidateid, candidate.lastname, candidate.firstname, candidate.year,candidate.course,position.description
FROM candidate inner join position where candidate.positionid = position.positionid";

 

$result = mysql_query($query);

 

print "<datas>";
    while ($recordset = mysql_fetch_object($result) ) {
        print "<data><id1>".$recordset->canID."</id1>
           <ln1>".$recordset->canLname."</ln1>
               <fn1>".$recordset->canFname."</fn1>
        <yr1>".$recordset->canYr."</yr1>
        <kurs1>".$recordset->kurs."</kurs1>
           <pos1>".$recordset->canPos."</pos1>
       
        </data>";
    }
print "</datas>";

Attachments:
 
Replies
  • Currently Being Moderated
    Aug 13, 2009 4:50 AM   in reply to re-Flexing

    this can be happen due to asynchronous call of HttpService & data u binded. Its happening like that,

     

    Datagrid intialize & displayed with null data  --> data came & set to dataGrid. On getting result of HttpService try to set result again.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 13, 2009 5:40 AM   in reply to re-Flexing
    <mx:HTTPService 
            id="photoService"
          
            resultFormat="e4x"
            result="photoResultHandler(event);"
            fault="photoFaultHandler(event);"
        />
    // Result handler - gets called after data comes from HttpService.
                private function photoResultHandler(event:ResultEvent):void
                {
                    set data here again to dataGrid which u have binded.
                }
     
    |
    Mark as:
  • Currently Being Moderated
    Aug 13, 2009 6:46 AM   in reply to re-Flexing

    actually its still in the queue

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points