0 Replies Latest reply on Aug 23, 2007 9:13 PM by y.muny

    Not Refresh Value After Add New Record used with RPC Component

    y.muny
      This is my code in the class Users.as
      package inthanous
      {
      import mx.controls.Alert;
      import mx.rpc.http.HTTPService;
      import mx.rpc.events.ResultEvent;
      import mx.rpc.events.FaultEvent;

      public class Users
      {
      private var service:HTTPService;

      [Bindable]
      public var xmllist_user:XMLList;

      public function Users(){
      service = new HTTPService();
      service.method = "POST";
      service.useProxy = false
      service.resultFormat = "e4x";
      }

      //--------------------------------------------------
      public function listUser():void{
      service.url = "/user/get_all_user_group_name";
      service.addEventListener("result", httpResultListUser);
      service.addEventListener("fault", httpFaultListUser);
      xmllist_user = new XMLList();
      service.send();
      }
      private function httpResultListUser(event:ResultEvent):void{
      service.removeEventListener("result", httpResultListUser);
      service.removeEventListener("fault", httpFaultListUser);
      xmllist_user = new XMLList(service.lastResult.children());
      listAllUser();
      }
      private function httpFaultListUser(event:FaultEvent):void{
      var faulstring:String = event.fault.message;
      service.removeEventListener("result", httpResultListUser);
      service.removeEventListener("fault", httpFaultListUser);
      Alert.show(faulstring,"Error");
      }

      //--------------------------------------------------
      public function createUser(_xml:XML):void{
      service.url = "/user/create_user";
      service.addEventListener("result", httpResultCreateUser);
      service.addEventListener("fault", httpFaultCreateUser);
      service.send({firstName: _xml.firstName,
      lastName: _xml.lastName,
      gender: _xml.gender,
      login: _xml.login,
      pwd: _xml.pwd,
      dtBirth: _xml.dtBirth,
      telephone: _xml.telephone,
      idGroup: _xml.idGroup
      });
      }
      private function httpResultCreateUser(event:ResultEvent):void{
      service.removeEventListener("result", httpResultCreateUser);
      service.removeEventListener("fault", httpFaultCreateUser);
      listUser();
      clearUserDetail();
      }
      private function httpFaultCreateUser(event:FaultEvent):void{
      var faulstring:String = event.fault.message;
      service.removeEventListener("result", httpResultCreateUser);
      service.removeEventListener("fault", httpFaultCreateUser);
      Alert.show(faulstring,"Error");
      }
      }
      }

      This code i used with Ruby on Rail to connect with MySQL.
      When i used with FireFox browse after i create new user success it refresh the new record in Datagrid. But for the Internet Explorer Datagrid not refresh it because of it display the old recode before create.
      So i don't know it problem by Internet Explorer or my script.
      i hope someone can help me the solve this problem.

      thanks