2 Replies Latest reply on Oct 24, 2007 7:37 AM by shadow_of__soul

    [help]Problem with datagrid and DB

    shadow_of__soul
      Hi,

      I have a problem with my flex2 aplication.
      EDIT:this happen in all browser no only in firefox

      i use a
      <mx:HTTPService id="userRequest4" url="DB.php" useProxy="false" method="POST">
      <mx:request xmlns="">
      </mx:request>
      </mx:HTTPService>

      to send a request to a php script what return data of the database, and this data is load in a datagrid in this form:

      <mx:DataGrid id="dg" width="100%" height="100%" dataProvider="{userRequest4.lastResult.pathis.Product}" editable="true" itemEditEnd="getCellInfo(event);">
      <mx:columns>
      <mx:DataGridColumn dataField="ids" headerText="ID" editable="false" />
      <mx:DataGridColumn dataField="nombre" headerText="Name"/>
      <mx:DataGridColumn dataField="price" headerText="Price"/>
      <mx:DataGridColumn dataField="S" headerText="S"/>
      <mx:DataGridColumn dataField="M" headerText="M"/>
      <mx:DataGridColumn dataField="L" headerText="L"/>
      <mx:DataGridColumn dataField="XL" headerText="XL"/>
      <mx:DataGridColumn dataField="XXL" headerText="XXL"/>
      <mx:DataGridColumn dataField="other" headerText="Other"/>
      </mx:columns>
      </mx:DataGrid>

      hre i call the php script, when someone clik in the option of the menu:
      private function menuHandler(event:MenuEvent):void {
      if(event.item.@label=='Manage Product'){
      Add_Products.visible=false;
      Add_Products.width=0;
      Add_Products.height=0;
      Add_design.visible=false
      Manage_Products.width=500;
      Manage_Products.height=500;
      Manage_Products.visible=true;
      Add_design.width=0;
      Add_design.height=0;
      userRequest4.url="MP.php";
      userRequest4.send();

      }
      }

      and this function update the DB when the cell is edited:

      private function getCellInfo(event:DataGridEvent):void {
      var myEditor:TextInput =
      TextInput(event.currentTarget.itemEditorInstance);
      // Get the new value from the editor.
      var newVal:String = myEditor.text;
      var objN=new Object();
      objN.ids=dg.selectedItem.ids;
      objN.dato=newVal;
      objN.fields=event.dataField;
      userRequest2.url="UP.php";
      userRequest2.send(objN);
      }

      and have the property to edit the cell, and when this happen update the database, this work perfectly no problem, but when reload the datagrid (i send the request to the DB.php) this show the value what have the cell before this have edited :/
      you know some way to fix it?
      if any know please help me, i need this urgent :D

      Regards,
      Shadow.