0 Replies Latest reply on Aug 19, 2009 8:47 AM by dmericksen

    Datagrid not refreshing?

    dmericksen

      Hello,

      I am new to flex.  I am developing an application to dispaly sales data.  I've successfully created an MXML datasource with php.  I've also connected this feed to flex via a datagrid.  The problem is, when I updated my data, for instance adding more records, the datagrid does not update.  In order to update the data, I have to open FlexBuilder and re-export the build.  As a novice, I am not sure what I am missing.  Please help!

       

      Here is a snippet of my code:

      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" backgroundColor="white" layout="absolute" width="824" height="668" backgroundGradientColors="[#FFFFFF, #FFFFFF]" currentState="sales_by_month">

          <mx:XML id="mydata" source="http://localhost:8888/www/flex_data/monthly_data.php"></mx:XML>

          <!--?action=5&s_date=2009-07-27&e_date=2009-08-03&s_status=%&sku=%&l_name=show_all"></mx: XML> --> 

           <mx:states>

              <mx:State name="sales_by_week">

                  <mx:AddChild position="lastChild">

                      <mx:DataGrid id="weekly_data" dataProvider="{mydata..sales_by_week}" width="652" height="213" textAlign="left" borderStyle="none" x="154" y="445">

                          <mx:columns>

                                  <mx:DataGridColumn headerText="Period" dataField="period"/>

                                  <mx:DataGridColumn dataField="week" />

                                  <mx:DataGridColumn dataField="YTD" />

                                  <mx:DataGridColumn dataField="month" />

                                  <mx:DataGridColumn dataField="total" />

                                  <mx:DataGridColumn dataField="revenue" />

                          </mx:columns>

                      </mx:DataGrid>

                  </mx:AddChild>

                  <mx:SetStyle target="{linkbutton2}" name="color" value="#DA8037"/>

                  <mx:SetStyle target="{linkbutton3}" name="color" value="#000000"/>

                  <mx:SetProperty target="{vrule1}" name="height" value="598"/>

                  <mx:SetProperty target="{label2}" name="y" value="412"/>

                  <mx:SetProperty target="{hrule1}" name="y" value="436"/>

                  <mx:SetStyle target="{linkbutton3}" name="fontWeight" value="normal"/>

                  <mx:SetStyle target="{linkbutton1}" name="fontWeight" value="normal"/>

              </mx:State>

      </mx:states>

      </mx:Application>