flex DataGrid 編輯后保存





          endpoint="http://www.mysite.com/amfphp/gateway.php" showBusyCursor="true"/>













          ----------------org\corlan\VOAuthor.as-----------------
          package org.corlan {

          [RemoteClass(alias="org.corlan.VOAuthor")]
          [Bindable]
          public class VOAuthor {

          public var id_aut:int;
          public var fname_aut:String;
          public var lname_aut:String;
          }
          }


          //----------------------------分析-------------------------------
          1 面向對象的設計思路,抽象出兩個模型,一個是php,一個是.as格式,互相對應,這兩個類的成員變量命名是一致的。

          2 注意文件的組織方式,模型文件均放在相關目錄下例如:org\corlan\VOAuthor.as,類文件首字母大寫

          3 注意{myRemote.getData()},調用以后沒有立即處理數據,而是通過"{myRemote.getData.lastResult}"的lastResult屬性去讀取緩存中的訪問結果。

          4 前端的mxml的script中:
          var dataGrid:DataGrid = event.target as DataGrid; //獲取當前編輯的單元格對象
          var dsColumnIndex:Number = event.columnIndex; //列號
          var col:DataGridColumn = dataGrid.columns[dsColumnIndex]; //?
          var newValue:String = dataGrid.itemEditorInstance[col.editorDataField]; //讀取新值,這里要研究下
          //dataGrid各個屬性的含義

          var author:VOAuthor = event.itemRenderer.data as VOAuthor; //獲取當前顯示的單元格對象
          author[dsFieldName] = newValue; //更新顯示狀態

          5 webservice的方式直接調用php中的存儲方法:
          myRemote.saveData(author);

          posted on 2011-01-06 15:25 aiaiwoo 閱讀(1189) 評論(0)  編輯  收藏 所屬分類: AC3/FLEX

          <2025年6月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          導航

          統計

          常用鏈接

          留言簿

          隨筆分類

          文章分類

          文章檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 收藏| 上思县| 蓬溪县| 闽侯县| 侯马市| 清镇市| 报价| 郴州市| 商南县| 定结县| 林芝县| 屯门区| 卓资县| 灵丘县| 湘西| 定结县| 双牌县| 莱州市| 拜泉县| 北京市| 邻水| 峡江县| 卢龙县| 图木舒克市| 红河县| 宜兴市| 西乌| 徐闻县| 新晃| 营口市| 白玉县| 兴文县| 乌苏市| 闽清县| 益阳市| 长寿区| 泉州市| 南汇区| 锡林郭勒盟| 嵊泗县| 龙山县|