티스토리 뷰

<?xml version="1.0" encoding="utf-8"?>
< mx:Application
      fontSize="14"
      layout="vertical"
      creationComplete="initApp()"
      xmlns:mx="http://www.adobe.com/2006/mxml"
      xmlns:view="view.*">
 

 <mx:Label text="DataGrid - dataProvider"/>
 <mx:DataGrid id="dgDataGrid"
           dataProvider="{acArticleData}">
       <mx:columns>
             <mx:DataGridColumn headerText="번호"  dataField="NUM"  textAlign="center" width="50"/>
             <mx:DataGridColumn headerText="아이디" dataField="ID"   textAlign="center" width="200"/>
             <mx:DataGridColumn headerText="패스워드" dataField="PASS" textAlign="center" width="200"/>
       </mx:columns>
 </mx:DataGrid>
 
 <mx:Label text="DataGrid - acArticleData"/>
 <mx:DataGrid id="dgDataGrid2"
                     itemClick="if(dgDataGrid2.selectedItem) itemClickHandler(dgDataGrid2.selectedItem.NUM)">
       <mx:columns>
             <mx:DataGridColumn headerText="번호"  dataField="NUM"  textAlign="center" width="50"/>
             <mx:DataGridColumn headerText="아이디" dataField="ID"   textAlign="center" width="200"/>
             <mx:DataGridColumn headerText="패스워드" dataField="PASS" textAlign="center" width="200"/>
       </mx:columns>
 </mx:DataGrid>
 
 <mx:ViewStack id="mainViewStack" width="100%" height="100%">
       <view:boardList id="boardList"/>
 </mx:ViewStack>
 <mx:ViewStack id="mainViewStack2" width="100%" height="100%">
       <view:boardEdit id="boardEdit"/>
 </mx:ViewStack>

 
 <!-- Script --> 
 <mx:Script>
       <![CDATA[
  
             import mx.collections.ArrayCollection;
             import mx.rpc.events.ResultEvent;
             import mx.rpc.events.FaultEvent;
             import mx.rpc.http.HTTPService;
             import mx.managers.CursorManager;
   
             import mx.controls.Alert;
   
             [Bindable]
             private var acArticleData:ArrayCollection = new ArrayCollection;
   
             private var httpserv:HTTPService;
  
             private function initApp():void {
                   httpserv = new HTTPService();
                   httpserv.method = "POST";
                   httpserv.resultFormat = "e4x";
                   httpserv.url = "http://dbs.dtitech.kr/Sub/cus/testBoard/php/SqlMapQuery.php";
    
                   var sqlArticle:Object = new Object;
                   sqlArticle.viewCheck = "boardList";
                   httpserv.addEventListener("result", resultHandler);
                   httpserv.addEventListener("fault", faultHandler);
                   httpserv.send(sqlArticle);
                   CursorManager.setBusyCursor();
              }
   
             private function itemClickHandler(article_num:int):void {
             }   
   
             private function resultHandler(event:ResultEvent):void {
                  CursorManager.removeBusyCursor();
                  httpserv.removeEventListener("result", resultHandler);
                  httpserv.removeEventListener("fault", faultHandler);
    
                  var xmlArticleData:XMLList = new XMLList();
                  xmlArticleData = event.result.articles.article;
                  acArticleData.removeAll();
    
                  var i:int;
                  for(i=0; i<xmlArticleData.length(); i++) {
                       var xmlArticle:XML = xmlArticleData[i];
                       acArticleData.addItem({
                                 NUM : xmlArticle.NUM,
                                 ID : xmlArticle.ID,
                                 PASS : xmlArticle.PASS
                    });
              }
    
              dgDataGrid2.dataProvider = acArticleData;
              boardList.dgDataGrid3.dataProvider = acArticleData;
    
        }
        private function faultHandler(event:FaultEvent):void {
              CursorManager.removeBusyCursor();
              httpserv.removeEventListener("result", resultHandler);
              httpserv.removeEventListener("fault", faultHandler);
              Alert.show(event.toString());
        }
   
   
  ]]>
 </mx:Script>
 
 
< /mx:Application>

Total
Today
Yesterday
최근에 올라온 글
«   2025/01   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31