grid

          grid

            BlogJava :: 首頁(yè) :: 聯(lián)系 :: 聚合  :: 管理
            78 Posts :: 0 Stories :: 62 Comments :: 0 Trackbacks

          2012年10月11日 #

          Pager:分頁(yè)控件
                          
                      
                               

          參考示例Pager:分頁(yè)控件


                      
                     

          創(chuàng)建代碼   

          <div class="mini-pager" style="width:600px;background:#ccc;" 
              totalCount="123" onpagechanged="onPageChanged" sizeList="[5,10,20,100]"
              showTotalCount="true"
              >        
          </div>    
          <script type="text/javascript">
              function onPageChanged(e) {
                  alert(e.pageIndex+":"+e.pageSize);
              }       
          </script>
          

                    
          posted @ 2013-01-06 17:05 nikofan 閱讀(2202) | 評(píng)論 (0)編輯 收藏

          OutlookTree:折疊樹(shù)
                          
                      
                            

          參考示例OutlookTree:折疊樹(shù)


                                 

          創(chuàng)建OutlookTree     

          <div id="leftTree" class="mini-outlooktree" url="../data/outlooktree.txt" onnodeselect="onNodeSelect"
              textField="text" idField="id" parentField="pid">
          </div>
                    

          數(shù)據(jù)格式

          [
              {id: "user", text: "用戶管理"},
                  
              {id: "lists", text: "Lists", pid: "user" },
                      
              {id: "datagrid", text: "DataGrid", pid: "lists"},            
              {id: "tree", text: "Tree" , pid: "lists"},
              {id: "treegrid", text: "TreeGrid " , pid: "lists"},
                  
              {id: "layouts", text: "Layouts", expanded: false, pid: "user"},
                  
              {id: "panel", text: "Panel", pid: "layouts"},
              {id: "splitter", text: "Splitter", pid: "layouts"},
              {id: "layout", text: "Layout ", pid: "layouts"},
                  
              { id: "right", text: "權(quán)限管理"},
                  
              {id: "base", text: "Base", expanded: false, pid: "right" },
                          
              {id: "ajax", text: "Ajax", pid: "base"},
              {id: "json", text: "JSON", pid: "base"},
              {id: "date", text: "Date", pid: "base"},
                  
              {id: "forms", text: "Forms", expanded: false, pid: "right"},
                          
              {id: "button", text: "Button", pid: "forms"},
              {id: "listbox", text: "ListBox", pid: "forms"},
              {id: "checkboxlist", text: "CheckBoxList", pid: "forms"},
              {id: "radiolist", text: "RadioList", pid: "forms"},
              {id: "calendar", text: "Calendar", pid: "forms"}                
          ]
          
          posted @ 2013-01-05 17:07 nikofan 閱讀(1849) | 評(píng)論 (0)編輯 收藏

          OutlookMenu:折疊菜單
                          
                                          

          參考示例OutlookMenu:折疊菜單

                  
                     

          創(chuàng)建OutlookMenu        

          <div class="mini-outlookmenu" url="../data/outlookmenu.txt" onitemselect="onItemSelect"
              idField="id" parentField="pid" textField="text">
          </div>
          
                     

          數(shù)據(jù)結(jié)構(gòu)

          [
              { id: "user", text: "用戶管理"},
              { id: "addUser", pid: "user", text: "增加用戶", iconCls: "icon-add", url: "../navbartree/navbartree.html" },
              { id: "editUser", pid: "user", text: "修改用戶", iconCls: "icon-edit", url: "../buttonedit/openwindow.html" },
              { id: "removeUser", pid: "user", text: "刪除用戶", iconCls: "icon-remove", url: "../datagrid/datagrid.html" },
                  
              { id: "right", text: "權(quán)限管理"},
              { id: "addRight", pid: "right", text: "查詢權(quán)限", iconCls: "Note", url: "../navbartree/navbartree.html", iconPosition: "top" },
              { id: "editRight", pid: "right", text: "操作權(quán)限", iconCls: "Reports", url: "../buttonedit/openwindow.html", iconPosition: "top" }        
          ]
          
          posted @ 2013-01-04 16:23 nikofan 閱讀(2135) | 評(píng)論 (0)編輯 收藏

          普加甘特圖是WEB甘特圖首選解決方案。適用于構(gòu)建項(xiàng)目管理、生產(chǎn)排程等進(jìn)度計(jì)劃管理軟件。支持任意開(kāi)發(fā)平臺(tái)和數(shù)據(jù)庫(kù)。它是JavaScript開(kāi)發(fā)的,無(wú)需安裝插件,跨瀏覽器運(yùn)行。

          基本特性

          • JavaScript實(shí)現(xiàn),無(wú)需安裝插件
          • 支持Java、.Net、Php等服務(wù)端,支持任意數(shù)據(jù)庫(kù)
          • 能與jQuery、ExtJS、YUI、Dojo等第三方框架無(wú)縫集成
          • 兼容IE6+、FireFox、Chrome、Safari等主流瀏覽器
          • 支持導(dǎo)入、導(dǎo)出微軟Project項(xiàng)目文件

          效果圖:

          Web甘特圖

          核心功能:

          • 高性能:支持大數(shù)據(jù)量。
          • 跟蹤甘特圖:顯示計(jì)劃與實(shí)際日期對(duì)比。
          • 關(guān)鍵路徑顯示
          • 自定義列:支持String、Boolean、Date、Number、Array等多種數(shù)據(jù)類型。
          • 支持4種任務(wù)關(guān)系:SS、SF、FF、FS。
          • 權(quán)限編輯控制:可根據(jù)權(quán)限精確控制單元格編輯、條形圖拖拽。
          • 懶加載顯示:通過(guò)分級(jí)加載模式,能支持超大數(shù)據(jù)量顯示。
          • 單元格編輯:支持TextBox、Spinner、DatePicker、ComboBox、TreeSelect以及自定義編輯器。
          • 可拖拽調(diào)節(jié)條形圖
          • 豐富的時(shí)間線刻度:支持年、半年、季度、月、周、日、時(shí)、分、秒。
          • 支持右鍵菜單:可以控制右鍵菜單項(xiàng)是否顯示、是否禁用。
          • 無(wú)需安裝瀏覽器插件
          • 跨瀏覽器支持:支持IE6+、FireFox、Opera、Chrome、Safari。
          • 跨服務(wù)端平臺(tái)支持:支持.Net、Java、PHP、ASP等開(kāi)發(fā)平臺(tái)。
          • 語(yǔ)言本地化:輕松實(shí)現(xiàn)多國(guó)語(yǔ)言本地化,如英語(yǔ)、漢語(yǔ)、日語(yǔ)、德語(yǔ)、法語(yǔ)等任何語(yǔ)言。
          • 與第三方框架集成:能輕松與jQuery、ExtJS、YUI、Prototype.js等無(wú)縫集成。

          功能示例:


          甘特圖效果截圖如下:
           
          基本甘特圖
          Web甘特圖

          排程甘特圖: 左側(cè)表格區(qū),單元格右上角紅色三角塊,表示被修改。
          排程甘特圖

          跟蹤甘特圖:實(shí)現(xiàn)實(shí)際與計(jì)劃日期的對(duì)比。
          跟蹤甘特圖

          關(guān)鍵路徑甘特圖:關(guān)鍵路徑的工期決定了整個(gè)項(xiàng)目的工期。
          關(guān)鍵路徑甘特圖

          任務(wù)面板
          任務(wù)面板

          項(xiàng)目日歷面板
          日歷面板

          多國(guó)語(yǔ)言本地化
          多國(guó)語(yǔ)言本地化
          posted @ 2012-12-31 21:09 nikofan 閱讀(3295) | 評(píng)論 (0)編輯 收藏

          OutlookBar:折疊面板組
                      
                                

          參考示例OutlookBar:折疊面板組


                              

          創(chuàng)建OutlookBar   

          <div id="outlookbar1" class="mini-outlookbar " activeIndex="0" style="width:180px;height:250px;" autoCollapse="true">
              <div title="權(quán)限管理">            
                  1
              </div>
              <div title="用戶管理">
                  2
              </div>
          </div>
          
          posted @ 2012-12-31 10:41 nikofan 閱讀(2359) | 評(píng)論 (1)編輯 收藏

          Tabs:懶加載頁(yè)面
                                            

          參考示例Tabs:懶加載頁(yè)面


                               

          創(chuàng)建Tabs

          <ul id="tree1" class="mini-tree" url="../data/tree.txt" style="width:300px;padding:5px;" 
              showTreeIcon="true" textField="text" idField="id" >        
          </ul>
          
                             

          數(shù)據(jù)結(jié)構(gòu)      

          通過(guò)url返回的數(shù)據(jù)結(jié)構(gòu)如下:

          [
              {title: "Tab1", url: "../tabs/pages/page1.html", refreshOnClick: true},
              {title: "Tab2", url: "../tabs/pages/page2.html", showCloseButton: true},
              {title: "Tab3", url: "../tabs/pages/page3.html"},
              {title: "Tab4", url: "../tabs/pages/page4.html"},
              {title: "Tab5", url: "../tabs/pages/page5.html"}
          ]
          
          posted @ 2012-12-28 15:12 nikofan 閱讀(2963) | 評(píng)論 (0)編輯 收藏

          Tabs:選項(xiàng)卡


          參考示例Tabs:選項(xiàng)卡


          創(chuàng)建Tabs

          <div id="tabs1" class="mini-tabs" activeIndex="0" style="width:350px;height:200px;">
              <div title
          ="Tab1">
                 
          1
              </div>
              <div title="Tab2" iconCls
          ="icon-cut" >
                 
          2
              </div>
              <div title="Tab3" showCloseButton
          ="true">
                 
          3
              </div>
              <div title="Tab4" showCloseButton="true" enabled
          ="false">
                 
          4
              </div>
          </div
          >

          其中,子tab具有如下屬性:

          Name Type Description Default
          name String 面板名稱
          title String 標(biāo)題文本
          newLine Boolean 是否換行 false
          iconCls String 標(biāo)題圖標(biāo)樣式類
          iconStyle String 標(biāo)題圖標(biāo)樣式
          headerCls String 頭部樣式類
          headerStyle String 頭部樣式
          bodyCls String 內(nèi)容區(qū)樣式類
          bodyStyle String 內(nèi)容區(qū)樣式
          visible Boolean 是否顯示 true
          enabled Boolean 是否啟用 true
          showCloseButton Boolean 是否顯示關(guān)閉按鈕 true
          url String 路徑地址
          onload Function 加載成功時(shí)激發(fā)
          ondestroy Function 銷毀時(shí)激發(fā)
          removeAction String tab的IFrame銷毀時(shí)的動(dòng)作,比如"close","cancel","ok"。
          posted @ 2012-12-24 16:46 nikofan 閱讀(3761) | 評(píng)論 (1)編輯 收藏

          ContextMenu:右鍵菜單
                          
                              

          參考示例ContextMenu:右鍵菜單

                 
                     

          創(chuàng)建ContextMenu

          <ul id="contextMenu" class="mini-contextmenu" >
              <li>
                  <span >操作</span>
                  <ul>
                      <li iconCls="icon-new" onclick="onItemClick">新建</li>
                      <li class="separator"></li>
                      <li iconCls="icon-add" onclick="onItemClick">增加</li>    
                      <li iconCls="icon-edit" onclick="onItemClick">修改</li>
                      <li iconCls="icon-remove" onclick="onItemClick">刪除</li>                      
                  </ul>
              </li>
              <li class="separator"></li>
              <li iconCls="icon-open" >打開(kāi)</li>
              <li iconCls="icon-remove" >關(guān)閉</li>
          </ul>
          
                   

          Javascript處理

          function onItemClick(e) {
              var item = e.sender;
              alert(item.getText());     
          }
          
          window.onload = function () {
              $("#region1").bind("contextmenu", function (e) {
                  var menu = mini.get("contextMenu");
                  menu.showAtPos(e.pageX, e.pageY);
                  return false;
              });
          }
          
                   
          posted @ 2012-12-21 16:47 nikofan 閱讀(2046) | 評(píng)論 (0)編輯 收藏

          菜單:Html標(biāo)簽
                          
                      
           參考示例菜單:Html標(biāo)簽
                             

          創(chuàng)建菜單       

          <ul id="menu2" class="mini-menubar" style="width:100%;">
              <li>
                  <span >文件(F)</span>
                  <ul>
                      <li onclick="onItemClick">
                          <span >新建</span>
                          <ul>
                              <li iconCls="icon-new" onclick="onItemClick">文件</li>
                              <li onclick="onItemClick">項(xiàng)目</li>
                              <li onclick="onItemClick">網(wǎng)站</li>
                          </ul>
                      </li>
                      <li class="separator"></li>
                      <li iconCls="icon-cut" onclick="onItemClick">Cut</li>
                      <li iconCls="icon-add" onclick="onItemClick">Add</li>
                      <li iconCls="icon-remove" onclick="onItemClick">Close</li>
                  </ul>
              </li>
              <li class="separator"></li>
              <li >編輯(E)</li>
              <li  onclick="onItemClick">查看(V)</li>
              <li iconCls="icon-help" onclick="onItemClick">幫助(H)</li>
          </ul>
          
          posted @ 2012-12-20 16:55 nikofan 閱讀(2232) | 評(píng)論 (1)編輯 收藏

               摘要: 普加甘特圖是WEB甘特圖首選解決方案。適用于構(gòu)建項(xiàng)目管理、生產(chǎn)排程等進(jìn)度計(jì)劃管理軟件。支持任意開(kāi)發(fā)平臺(tái)和數(shù)據(jù)庫(kù)。它是JavaScript開(kāi)發(fā)的,無(wú)需安裝插件,跨瀏覽器運(yùn)行。

          JavaScript實(shí)現(xiàn),無(wú)需安裝插件
          支持Java、.Net、Php等服務(wù)端,支持任意數(shù)據(jù)庫(kù)
          能與jQuery、ExtJS、YUI、Dojo等第三方框架無(wú)縫集成
          兼容IE6+、FireFox、Chrome、Safari等主流瀏覽器
          支持導(dǎo)入、導(dǎo)出微軟Project項(xiàng)目文件  閱讀全文
          posted @ 2012-12-20 10:39 nikofan 閱讀(2287) | 評(píng)論 (0)編輯 收藏

          菜單         
                             
          參考示例菜單
                     
                     

          創(chuàng)建菜單         

          <ul id="menu1" class="mini-menubar" style="width:100%;" 
              url="../data/listMenu.txt" idField="id" parentField="pid">
          </ul>
          

                     

          url數(shù)據(jù)格式

          [
              { id: "1", text: "文件(F)"},        
              '-',
              { id: "2", text: "新建", iconCls: "icon-new", pid: "1"},    
              { id: "3", text: "文件", pid: "2"},
              { id: "4", text: "文件夾", pid: "2"},        
              { id: "5", text: "打開(kāi)", iconCls: "icon-folderopen", pid: "1"},
              { id: "6", text: "保存", pid: "1"},
              { id: "7", text: "關(guān)閉", pid: "1"},
                  
              { id: "8", text: "編輯(E)"},
              { id: "9", text: "剪切", iconCls: "icon-cut", pid: "8"},
              { id: "10", text: "復(fù)制", pid: "8"},
              { id: "11", text: "粘貼", pid: "8"},
                  
              { id: "12", text: "查看(V)"},
              { id: "13", text: "幫助(H)", iconCls: "icon-help"}
          ]
          
                  
          posted @ 2012-12-19 16:25 nikofan 閱讀(1596) | 評(píng)論 (0)編輯 收藏

          ToolBar:工具欄           
                                     

          參考示例ToolBar:工具欄
                             

          創(chuàng)建工具欄      

          <div class="mini-toolbar">
              <a class="mini-button" iconCls="icon-add">增加</a>
              <a class="mini-button" iconCls="icon-edit">修改</a>
              <a class="mini-button" iconCls="icon-remove">刪除</a>
              <span class="separator"></span>
              <a class="mini-button" plain="true">增加</a>
              <a class="mini-button" plain="true">修改</a>
              <a class="mini-button" plain="true">刪除</a>
              <span class="separator"></span>
              <input class="mini-textbox" />   
              <a class="mini-button" plain="true">查詢</a>
          </div>
          
                     

          復(fù)雜工具欄

          <div id="toolbar1" class="mini-toolbar" style="padding:2px;">
              <table style="width:100%;">
                  <tr>
                  <td style="width:100%;">
                      <a class="mini-menubutton" plain="true" menu="#popupMenu">文件</a>
                      <a class="mini-button" iconCls="icon-addfolder" plain="true" enabled="false">增加</a>
                      <a class="mini-button" iconCls="icon-edit" plain="true">修改</a>
                      <a class="mini-button" iconCls="icon-remove" plain="true">刪除</a>
                      <span class="separator"></span>
                      <a class="mini-button" iconCls="icon-reload" plain="true">刷新</a>
                      <a class="mini-button" iconCls="icon-download" plain="true">下載</a>
                  </td>
                  <td style="white-space:nowrap;"><label style="font-family:Verdana;">Filter by: </label>
                      <input class="mini-textbox" />
                      </td>
                  </tr>
              </table>
          </div>
          
          posted @ 2012-12-18 17:03 nikofan 閱讀(2745) | 評(píng)論 (0)編輯 收藏

          TreeGrid:節(jié)點(diǎn)拖拽
                      
                               

          參考示例: TreeGrid:節(jié)點(diǎn)拖拽    
                          

          創(chuàng)建代碼    

          <div id="treegrid1" class="mini-treegrid" style="width:600px;height:280px;"     
              url="../data/tasks.txt" showTreeIcon="true" 
              treeColumn="taskname" idField="UID" parentField="ParentTaskUID" resultAsTree="false"
              allowDrag="true" allowDrop="true">
              <div property="columns">
                  <div type="indexcolumn"></div>
                  <div name="taskname" field="Name" width="200">任務(wù)名稱</div>
                  <div field="Duration" width="100">工期</div>
                  <div field="Start" width="100" dateFormat="yyyy-MM-dd">開(kāi)始日期</div>
                  <div field="Finish" width="100" dateFormat="yyyy-MM-dd">完成日期</div>
              </div>
          </div>                     
          • allowDrag:允許拖拽節(jié)點(diǎn)               
          • allowDrop:允許投放節(jié)點(diǎn)
          posted @ 2012-12-17 20:27 nikofan 閱讀(1660) | 評(píng)論 (0)編輯 收藏

          TreeGrid:繪制單元格
                      
                      
          參考示例: TreeGrid:繪制單元格    
                         
                    

          監(jiān)聽(tīng)處理"drawcell"事件         

          使用"drawcell"事件,可以自定義單元格內(nèi)容、樣式、行樣式等。

          function onDrawCell(e){
              var node = e.node,
                  column = e.column,
                  field = e.field,
                  value = e.value;
          
              //格式化日期
              if (field == "Finish") {
                  if (mini.isDate(value)) e.cellHtml = mini.formatDate(value, "yyyy年MM月dd日");
              }
              //工期
              if (field == "Duration") {
                  e.cellHtml = value + "天";
              }
              //進(jìn)度
              if (field == "PercentComplete") {
                  e.cellHtml = '<div class="progressbar">'
                                  + '<div class="progressbar-percent" style="width:' + value + '%;"></div>'
                                  + '<div class="progressbar-label">' + value + '%</div>'
                              +'</div>';
              }
          };
          posted @ 2012-12-14 15:58 nikofan 閱讀(2746) | 評(píng)論 (2)編輯 收藏

          TreeGrid:懶加載
                      
                      
          參考示例TreeGrid:懶加載    
                                     

          創(chuàng)建代碼

          <div id="treegrid1" class="mini-treegrid" style="width:600px;height:250px;"     
              url="../data/TreeService.aspx?method=LoadNodes" showTreeIcon="true" textField="text" idField="id" 
              treeColumn="filename" onbeforeload="onBeforeTreeLoad">
              <div property="columns">
                  <div name="filename" field="name" width="150">名稱</div>
                  <div field="type" width="100">類型</div>
                  <div field="size" width="100" dateFormat="yyyy-MM-dd">大小</div>
                  <div field="createdate" width="100" dateFormat="yyyy-MM-dd">創(chuàng)建日期</div>
              </div>
          </div>
          
                    

          服務(wù)端返回?cái)?shù)據(jù)

          [{
              id: "form",
              text: "Form",
              ......
              isLeaf: false,                            //是否葉子節(jié)點(diǎn):+和-號(hào)
              expanded: false                            //節(jié)點(diǎn)處于收縮狀態(tài)
          },
          ......
          ]
          
          其中,isLeft 說(shuō)明此節(jié)點(diǎn)是否有下一級(jí)節(jié)點(diǎn)。expanded 表示此節(jié)點(diǎn)處于折疊狀態(tài)。
                      
                     

          懶加載事件         

          當(dāng)用戶點(diǎn)擊"+"圖標(biāo)時(shí),會(huì)自動(dòng)加載下一級(jí)節(jié)點(diǎn),此時(shí)會(huì)把當(dāng)前節(jié)點(diǎn)id傳遞到后臺(tái),也可以攔截加載事件,增加額外屬性:

          function onBeforeTreeLoad(e) {
              var tree = e.sender;    //樹(shù)控件
              var node = e.node;      //當(dāng)前節(jié)點(diǎn)
              var params = e.params;  //參數(shù)對(duì)象
          
              //可以傳遞自定義的屬性
              params.myField = "123"; //后臺(tái):request對(duì)象獲取"myField"
          }
          

                     

          服務(wù)端處理          

          服務(wù)端通過(guò)request獲取"id"屬性后,加載此節(jié)點(diǎn)的下一級(jí)節(jié)點(diǎn)數(shù)組,并通過(guò)JSON返回。

          String id = Request["id"];
          if (String.IsNullOrEmpty(id)) id = "-1";
          
          //獲取下一級(jí)節(jié)點(diǎn)
          String sql = "select * from plus_file where pid = '" + id + "' order by updatedate";
          ArrayList folders = DBUtil.Select(sql);
          
          //判斷節(jié)點(diǎn),是否有子節(jié)點(diǎn)。如果有,則處理isLeaf和expanded。
          for (int i = 0, l = folders.Count; i < l; i++)
          {
              Hashtable node = (Hashtable)folders[i];
              String nodeId = node["id"].ToString();
          
              String sql2 = "select * from plus_file where pid = '" + nodeId + "' order by updatedate";
              ArrayList nodes = DBUtil.Select(sql2);
          
              if (nodes.Count > 0)
              {
                  node["isLeaf"] = false;
                  node["expanded"] = false;
              }
          
          }
          
          //返回JSON
          String json = PluSoft.Utils.JSON.Encode(folders);
          Response.Write(json);
          
          posted @ 2012-12-13 16:56 nikofan 閱讀(2833) | 評(píng)論 (0)編輯 收藏

               摘要: 普加甘特圖是WEB甘特圖首選解決方案。適用于構(gòu)建項(xiàng)目管理、生產(chǎn)排程等進(jìn)度計(jì)劃管理軟件。支持任意開(kāi)發(fā)平臺(tái)和數(shù)據(jù)庫(kù)。它是JavaScript開(kāi)發(fā)的,無(wú)需安裝插件,跨瀏覽器運(yùn)行。  閱讀全文
          posted @ 2012-12-13 10:01 nikofan 閱讀(5171) | 評(píng)論 (1)編輯 收藏

          TreeGrid
                      
                      
          參考示例: TreeGrid    
                          
                     

          創(chuàng)建TreeGrid

          <div id="treegrid1" class="mini-treegrid" style="width:600px;height:280px;"     
              url="../data/tasks.txt" showTreeIcon="true" 
              treeColumn="taskname" idField="UID" parentField="ParentTaskUID" resultAsTree="false">
              <div property="columns">
                  <div type="indexcolumn"></div>
                  <div name="taskname" field="Name" width="200">任務(wù)名稱</div>
                  <div field="Duration" width="100">工期</div>
                  <div field="Start" width="100" dateFormat="yyyy-MM-dd">開(kāi)始日期</div>
                  <div field="Finish" width="100" dateFormat="yyyy-MM-dd">完成日期</div>
              </div>
          </div>           

          注意:idField、parentField、resultAsTree屬性。


                 
                     

          數(shù)據(jù)結(jié)構(gòu):列表         

          通過(guò)url返回的數(shù)據(jù)結(jié)構(gòu)如下:

          [
              {id: "base", text: "Base", expanded: false},    
              {id: "ajax", text: "Ajax", pid: "base"},
              {id: "json", text: "JSON", pid: "base"},
              ......
          ]
          
          其中,id和pid對(duì)應(yīng)父子關(guān)系。
                     

          Columns列配置         

          TreeGrid的列配置,跟DataGrid類似。參考如下:

          posted @ 2012-12-12 17:04 nikofan 閱讀(3822) | 評(píng)論 (0)編輯 收藏

          過(guò)濾樹(shù)           
                             

          參考示過(guò)濾樹(shù)


                                 

          filter節(jié)點(diǎn)過(guò)濾          

          tree.filter(function (node) {
              var text = node.text ? node.text.toLowerCase() : "";
              if (text.indexOf(key) != -1) {
                  return true;
              }
          });
          
                    

          clearFilter取消過(guò)濾         

          tree.clearFilter();
          
          posted @ 2012-12-11 16:02 nikofan 閱讀(1605) | 評(píng)論 (0)編輯 收藏

          樹(shù)右鍵菜單
                             

          參考示例樹(shù)右鍵菜單

                

                     

          一:創(chuàng)建ContextMenu     

          <ul id="treeMenu" class="mini-contextmenu"  onbeforeopen="onBeforeOpen">        
              <li iconCls="icon-move" onclick="onMoveNode">移動(dòng)節(jié)點(diǎn)</li>
              <li class="separator"></li>
              <li>
                  <span iconCls="icon-add">新增節(jié)點(diǎn)</span>
                  <ul>
                      <li onclick="onAddBefore">插入節(jié)點(diǎn)前</li>                
                      <li onclick="onAddAfter">插入節(jié)點(diǎn)后</li>    
                      <li onclick="onAddNode">插入子節(jié)點(diǎn)</li>                 
                  </ul>
              </li>
              <li name="edit" iconCls="icon-edit" onclick="onEditNode">編輯節(jié)點(diǎn)</li>
              <li name="remove" iconCls="icon-remove" onclick="onRemoveNode">刪除節(jié)點(diǎn)</li>        
          </ul>
          

                     

          二:設(shè)置contextmenu   

          <ul id="tree1" class="mini-tree" url="../data/tree.txt" style="width:200px;padding:5px;" 
              showTreeIcon="true" textField="text" idField="id" 
              contextMenu="#treeMenu">        
          </ul>
          

                    

          三:監(jiān)聽(tīng)beforeopen事件   

          function onBeforeOpen(e) {
              var menu = e.sender;
              var tree = mini.get("tree1");
          
              var node = tree.getSelectedNode();
              if (!node) {
                  e.cancel = true;
              }
              if (node && node.text == "Base") {
                  e.cancel = true;
                  //阻止瀏覽器默認(rèn)右鍵菜單
                  e.htmlEvent.preventDefault();
                  return;
              }
          
              ////////////////////////////////
              var editItem = mini.getbyName("edit", menu);
              var removeItem = mini.getbyName("remove", menu);
              editItem.show();
              removeItem.enable();
          
              if (node.id == "forms") {
                  editItem.hide();
              }
              if (node.id == "lists") {
                  removeItem.disable();
              }
          }
          





                 

                     
                 

             
          posted @ 2012-12-10 16:24 nikofan 閱讀(2257) | 評(píng)論 (0)編輯 收藏

          自定義節(jié)點(diǎn)
                                 

          參考示例自定義節(jié)點(diǎn)


                                 

          創(chuàng)建代碼         

          <ul id="tree1" class="mini-tree" url="../data/tree.txt" style="width:200px;padding:5px;" 
              showTreeIcon="true" textField="text" idField="id" 
              ondrawnode="onDrawNode" showCheckBox="true">        
          </ul>           

          此時(shí),我們監(jiān)聽(tīng)了“drawnode”事件。


                     

          drawnode 事件         

          function onDrawNode(e) {
              var tree = e.sender;
              var node = e.node;
          
              var hasChildren = tree.hasChildren(node);
          
              //所有子節(jié)點(diǎn)加上超鏈接
              if (hasChildren == false) {
                  e.nodeHtml = '<a  + node.id + '.html" target="_blank">' + node.text + '</a>';
              }
          
              //父節(jié)點(diǎn)高亮顯示;子節(jié)點(diǎn)斜線、藍(lán)色、下劃線顯示
              if (hasChildren == true) {
                  e.nodeStyle = 'font-weight:bold;';
              } else {
                  e.nodeStyle = "font-style:italic;"; //nodeStyle
                  e.nodeCls = "blueColor";            //nodeCls
              }
          
              //修改默認(rèn)的父子節(jié)點(diǎn)圖標(biāo)
              if (hasChildren == true) {
                  e.iconCls = "folder";
              } else {
                  e.iconCls = "file";
              }
          
              //父節(jié)點(diǎn)的CheckBox全部隱藏
              if (hasChildren == true) {
                  e.showCheckBox = false;
              }
          }
          

             
          Note:   
          1. 文本內(nèi)容(nodeHtml):所有子節(jié)點(diǎn)加上超鏈接   
          2. 節(jié)點(diǎn)樣式(nodeStyle/nodeCls):父節(jié)點(diǎn)高亮顯示;子節(jié)點(diǎn)斜線、藍(lán)色、下劃線顯示     
          3. 節(jié)點(diǎn)圖片(iconCls):修改默認(rèn)的父子節(jié)點(diǎn)圖標(biāo)           
          4. 隱藏CheckBox(showCheckBox):父節(jié)點(diǎn)的CheckBox全部隱藏           
          5. 開(kāi)發(fā)者可以擴(kuò)展節(jié)點(diǎn)判斷條件,對(duì)文本、樣式、圖標(biāo)、CheckBox等做任意自定義.
          posted @ 2012-12-07 16:21 nikofan 閱讀(2780) | 評(píng)論 (0)編輯 收藏

          節(jié)點(diǎn)拖拽投放
                                        

          參考示例節(jié)點(diǎn)拖拽投放

                  

          創(chuàng)建代碼          

          <ul id="tree1" class="mini-tree" url="../data/tree.txt" style="width:200px;padding:5px;" 
              showTreeIcon="true" textField="text" idField="id" 
              allowDrag="true" allowDrop="true">
          </ul>
          
          • allowDrag:允許拖拽節(jié)點(diǎn)               
          • allowDrop:允許投放節(jié)點(diǎn)

          •            
          posted @ 2012-12-06 16:31 nikofan 閱讀(1999) | 評(píng)論 (1)編輯 收藏

          多選樹(shù):CheckBoxTree
                                           

          參考示例多選樹(shù):CheckBoxTree

                               

          創(chuàng)建代碼           

          <ul id="tree2" class="mini-tree" url="../data/tree.txt" style="width:300px;" 
              showTreeIcon="true" textField="text" idField="id" showCheckBox="true"
              onbeforenodecheck="onBeforeNodeCheck" checkRecursive="true" allowSelect="false" enableHotTrack="false">        
          </ul>                       
          • showCheckBox:顯示樹(shù)形的checkbox
          •                
          • checkRecursive:決定是否聯(lián)動(dòng)選擇
          •                     

          設(shè)置多選

          tree.setValue("forms,button,lists");
          
                  

          獲取多選

          var value = tree.getValue();
          alert(value);
          
          posted @ 2012-12-05 16:24 nikofan 閱讀(4281) | 評(píng)論 (1)編輯 收藏

          樹(shù)操作:增加、刪除、修改、移動(dòng)
                              

          參考示例增加、刪除、修改節(jié)點(diǎn)


                                 

          增加節(jié)點(diǎn)          

          var tree = mini.get("tree1");
          var node = tree.getSelectedNode();
          var newNode = {};
          tree.addNode(newNode, "before", node);
          
                    

          刪除節(jié)點(diǎn)   

          var node = tree.getSelectedNode();
          tree.removeNode(node);
          
                    

          編輯節(jié)點(diǎn)    

          var node = tree.getSelectedNode();            
          tree.beginEdit(node);  
          
                    

          移動(dòng)節(jié)點(diǎn)   

          tree.moveNode(node, targetNode, "before");
          
          posted @ 2012-12-04 15:31 nikofan 閱讀(6782) | 評(píng)論 (6)編輯 收藏

          懶加載樹(shù)
                               

          參考示例懶加載樹(shù)


                                

          創(chuàng)建代碼                    

          <ul id="tree1" class="mini-tree" url="../data/TreeService.aspx?method=LoadNodes" style="width:300px;height:200px;padding:5px;" 
              showTreeIcon="true" textField="name" idField="id" onbeforeload="onBeforeTreeLoad" 
                  >        
          </ul>
          
                
                     

          服務(wù)端返回?cái)?shù)據(jù)

          [{
              id: "form",
              text: "Form",
              ......
              isLeaf: false,                            //是否葉子節(jié)點(diǎn):+和-號(hào)
              expanded: false                            //節(jié)點(diǎn)處于收縮狀態(tài)
          },
          ......
          ]
          
          其中,isLeft 說(shuō)明此節(jié)點(diǎn)是否有下一級(jí)節(jié)點(diǎn)。expanded 表示此節(jié)點(diǎn)處于折疊狀態(tài)。           
                     

          懶加載事件          

          當(dāng)用戶點(diǎn)擊"+"圖標(biāo)時(shí),會(huì)自動(dòng)加載下一級(jí)節(jié)點(diǎn),此時(shí)會(huì)把當(dāng)前節(jié)點(diǎn)id傳遞到后臺(tái),也可以攔截加載事件,增加額外屬性:

          function onBeforeTreeLoad(e) {
              var tree = e.sender;    //樹(shù)控件
              var node = e.node;      //當(dāng)前節(jié)點(diǎn)
              var params = e.params;  //參數(shù)對(duì)象
          
              //可以傳遞自定義的屬性
              params.myField = "123"; //后臺(tái):request對(duì)象獲取"myField"
          }
          

                     

          服務(wù)端處理        

          服務(wù)端通過(guò)request獲取"id"屬性后,加載此節(jié)點(diǎn)的下一級(jí)節(jié)點(diǎn)數(shù)組,并通過(guò)JSON返回。

          String id = Request["id"];
          if (String.IsNullOrEmpty(id)) id = "-1";
          
          //獲取下一級(jí)節(jié)點(diǎn)
          String sql = "select * from plus_file where pid = '" + id + "' order by updatedate";
          ArrayList folders = DBUtil.Select(sql);
          
          //判斷節(jié)點(diǎn),是否有子節(jié)點(diǎn)。如果有,則處理isLeaf和expanded。
          for (int i = 0, l = folders.Count; i < l; i++)
          {
              Hashtable node = (Hashtable)folders[i];
              String nodeId = node["id"].ToString();
          
              String sql2 = "select * from plus_file where pid = '" + nodeId + "' order by updatedate";
              ArrayList nodes = DBUtil.Select(sql2);
          
              if (nodes.Count > 0)
              {
                  node["isLeaf"] = false;
                  node["expanded"] = false;
              }
          
          }
          
          //返回JSON
          String json = PluSoft.Utils.JSON.Encode(folders);
          Response.Write(json);
          
          posted @ 2012-12-03 16:14 nikofan 閱讀(2526) | 評(píng)論 (0)編輯 收藏

          創(chuàng)建樹(shù):Html生成             
          參考示例創(chuàng)建樹(shù):Html生成
                      
                   

          Html標(biāo)簽創(chuàng)建節(jié)點(diǎn)  

          <ul id="tree2" class="mini-tree" style="width:200px;padding:5px;" showTreeIcon="true">
              <li>
                  <span>MiniUI</span>
                  <ul>
                      <li>
                          <span expanded="false">Form</span>
                          <ul>                           
                              <li>ComboBox</li>
                              <li>DatePicker</li>
                              <li>Spinner</li>
                              <li>TreeSelect</li>
                          </ul>
                      </li>
                      <li>
                          <span expanded="false">Lists</span>
                          <ul>
                              <li><a href="../datagrid/datagrid.html" target="_blank" style="color:Blue;text-decoration:underline;">DataGrid</a></li>
                              <li>Tree</li>
                          </ul>
                      </li>    
                      <li>
                          <span expanded="false">Layouts</span>
                          <ul>
                              <li>Panel</li>
                              <li>Splitter</li>
                              <li>Layout</li>
                          </ul>
                      </li>         
                      <li>
                          <span expanded="false">Navigations</span>
                          <ul>
                              <li>Tabs</li>
                              <li>NavBar</li>
                              <li>Menu</li>
                              <li>Pager</li>                            
                          </ul>
                      </li>             
                  </ul>
              </li>                       
          </ul>
          
                      
          posted @ 2012-11-30 16:02 nikofan 閱讀(1612) | 評(píng)論 (0)編輯 收藏

          創(chuàng)建樹(shù):本地JSON
                                  

          參考示例創(chuàng)建樹(shù):本地JSON


                     

          創(chuàng)建Tree          

          沒(méi)有設(shè)置url。

          <ul id="tree3" class="mini-tree" style="width:300px;padding:5px;" 
              showTreeIcon="true" textField="text" idField="id" >        
          </ul>
                    
                             

          Javascript設(shè)置數(shù)據(jù)

          var tree3 = mini.get("tree3");
          tree3.loadData([
              { id: "lists", text: "Lists", expanded: false,
                  children: [
                      { id: "datagrid", text: "DataGrid" },
                      { id: "tree", text: "Tree" },
                      { id: "treegrid", text: "TreeGrid " }
                  ]
                      },
              { id: "layouts", text: "Layouts", expanded: false,
                  children: [
                      { id: "panel", text: "Panel" },
                      { id: "splitter", text: "Splitter" },
                      { id: "layout", text: "Layout " }
                  ]
              },
              { id: "navigations", text: "Navigations", expanded: false,
                  children: [
                      { id: "pager", text: "Pager" },
                      { id: "tabs", text: "Tabs" },
                      { id: "navbar", text: "NavBar" },
                      { id: "menu", text: "Menu" }
                  ]
              }
          ]);
          
          posted @ 2012-11-29 16:18 nikofan 閱讀(1859) | 評(píng)論 (1)編輯 收藏

          創(chuàng)建樹(shù):列表結(jié)構(gòu)
                          
                                         

          參考示例: 列表數(shù)據(jù)生成Tree


                                 

          創(chuàng)建Tree           

          <ul id="tree1" class="mini-tree" url="../data/listTree.txt" style="width:200px;padding:5px;" 
              showTreeIcon="true" textField="text" idField="id" parentField="pid" resultAsTree="false"  
              >
          </ul>          

          注意:idField、parentField、resultAsTree屬性。


                 
                     

          數(shù)據(jù)結(jié)構(gòu):列表          

          通過(guò)url返回的數(shù)據(jù)結(jié)構(gòu)如下:

          [
              {id: "base", text: "Base", expanded: false},    
              {id: "ajax", text: "Ajax", pid: "base"},
              {id: "json", text: "JSON", pid: "base"},
              ......
          ]
          
          其中,id和pid對(duì)應(yīng)父子關(guān)系。
          posted @ 2012-11-28 16:00 nikofan 閱讀(1348) | 評(píng)論 (0)編輯 收藏

          創(chuàng)建樹(shù):樹(shù)形結(jié)構(gòu)
                          
                                         

          參考示例Tree 樹(shù)形控件


                                

          創(chuàng)建Tree           

          <ul id="tree1" class="mini-tree" url="../data/tree.txt" style="width:300px;padding:5px;" 
              showTreeIcon="true" textField="text" idField="id" >        
          </ul>
                 
                     

          數(shù)據(jù)結(jié)構(gòu):樹(shù)形          

          通過(guò)url返回的數(shù)據(jù)結(jié)構(gòu)如下:

          [
              {id: "base", text: "Base", expanded: false,
                  children: [
                      {id: "ajax", text: "Ajax"},
                      {id: "json", text: "JSON"},
                      {id: "date", text: "Date"},
                      {id: "control", text: "Control"},
                      {id: "messagebox", text: "MessageBox"},
                      {id: "window", text: "Window"}
                  ]
              },
              ...
          ]
          
          posted @ 2012-11-27 16:00 nikofan 閱讀(1589) | 評(píng)論 (0)編輯 收藏

          DataBinding:數(shù)據(jù)綁定
                          
                     

          參考示例DataBinding:數(shù)據(jù)綁定


                                

          數(shù)據(jù)綁定         

          數(shù)據(jù)綁定后:當(dāng)表格變化時(shí),控件值跟隨變動(dòng);控件值修改時(shí),表格單元格內(nèi)容變動(dòng)。
                          最后使用表格的數(shù)據(jù)提交保存,達(dá)到:多次修改、一次保存的效果。

          //綁定表單
          var db = new mini.DataBinding();
          db.bindForm("editForm1", grid);
          
          //綁定控件
          db.bindField(textbox, grid, "username");
          
                     
          posted @ 2012-11-26 15:48 nikofan 閱讀(1361) | 評(píng)論 (0)編輯 收藏

          表格:合并單元格
                          
                      
                               

          參考示例合并單元格


                                 
                     

          調(diào)用方法:margeCells。如下代碼:

          grid.on("load", onLoad);
          function onLoad(e) {
              var grid = e.sender;
          
              var marges = [
                  { rowIndex: 1, columnIndex: 0, rowSpan: 1, colSpan: 2 },
                  { rowIndex: 3, columnIndex: 0, rowSpan: 4, colSpan: 3 }
              ];
          
              grid.margeCells(marges);
          }
          
          posted @ 2012-11-23 15:53 nikofan 閱讀(1912) | 評(píng)論 (0)編輯 收藏

          表格:分組
                          
                      
                                

          參考示例分組

                             
                     

          調(diào)用分組方法:groupBy。如下代碼:

          grid.groupBy("gender", "asc");
          

                 

                 

                     
                 

             
          posted @ 2012-11-22 16:54 nikofan 閱讀(1900) | 評(píng)論 (0)編輯 收藏

          表格:右鍵菜單
                          
                               

          參考示例右鍵菜單


                      
                    

          一:創(chuàng)建ContextMenu

          <ul id="gridMenu" class="mini-contextmenu" onbeforeopen="onBeforeOpen">              
              <li name="add" iconCls="icon-add" onclick="onAdd">新增</li>
              <li name="edit" iconCls="icon-edit" onclick="onEdit">編輯節(jié)點(diǎn)</li>
              <li name="remove" iconCls="icon-remove" onclick="onRemove">刪除節(jié)點(diǎn)</li>        
          </ul>
          

                     

          二:設(shè)置表格contextmenu

          <div id="datagrid1" class="mini-datagrid" 
              contextMenu="#gridMenu">
              ......
          </div>   
          

                     

          三:監(jiān)聽(tīng)beforeopen事件          

          監(jiān)聽(tīng)右鍵菜單的beforeopen事件,可以對(duì)右鍵菜單精確控制。

          function onBeforeOpen(e) {
              var grid = mini.get("datagrid1");
              var menu = e.sender;
                      
              var row = grid.getSelected();
              var rowIndex = grid.indexOf(row);            
              if (!row ||  rowIndex== 0) {
                  e.cancel = true;
                  //阻止瀏覽器默認(rèn)右鍵菜單
                  e.htmlEvent.preventDefault();
                  return;
              }
              ////////////////////////////////
              var editItem = mini.getbyName("edit", menu);
              var removeItem = mini.getbyName("remove", menu);
              editItem.show();
              removeItem.enable();
          
              if (rowIndex == 1) {
                  editItem.hide();
              }
              if (rowIndex == 1) {
                  removeItem.disable();
              }
          
          }
          

                     

          四:表頭菜單headerContextMenu


           創(chuàng)建同樣一個(gè)menu菜單對(duì)象,設(shè)置給表格的headerContextMenu屬性即可。
          posted @ 2012-11-21 17:20 nikofan 閱讀(2272) | 評(píng)論 (0)編輯 收藏

          單元格編輯驗(yàn)證
                      
                      
                     

          參考示例單元格編輯驗(yàn)證


                               

          一:設(shè)置編輯器驗(yàn)證規(guī)則

          <div field="loginname" width="120" headerAlign="center" allowSort="true">員工帳號(hào)
              <input property="editor" class="mini-textbox" style="width:100%;" required="true" vtype="email"  />
          </div>       
          
          使用編輯器的vtype和onvalidation事件,可以實(shí)現(xiàn)編輯器驗(yàn)證規(guī)則。詳細(xì)可以查看:數(shù)據(jù)驗(yàn)證
                     

          二:監(jiān)聽(tīng)處理cellcommitedit事件

          //提交單元格編輯數(shù)據(jù)前激發(fā)
          function onCellCommitEdit(e) {
              var editor = e.editor;
              editor.validate();
              if (editor.isValid() == false) {
                  alert(editor.getErrorText());
                  e.cancel = true;
              }
          }
          grid.on("cellcommitedit", onCellCommitEdit);
          

          Grid的cellcommitedit事件,在編輯值提交前激發(fā)。此時(shí),可以調(diào)用編輯器的驗(yàn)證方法validate,判斷輸入的內(nèi)容是否符合驗(yàn)證規(guī)則。
          posted @ 2012-11-20 15:38 nikofan 閱讀(3213) | 評(píng)論 (1)編輯 收藏

          CRUD之:彈出面板編輯
                      
                                

          參考示例CRUD之:彈出面板編輯


                                

          一:創(chuàng)建彈出編輯面板

          <div id="editWindow" class="mini-window" title="Window" style="width:650px;" 
              showModal="true" allowResize="true" allowDrag="true"
              >
              <div id="editform" class="form" >
                  <input class="mini-hidden" name="id"/>
                  <table style="width:100%;">
                      <tr>
                          <td style="width:80px;">員工帳號(hào):</td>
                          <td style="width:150px;"><input name="loginname" class="mini-textbox" /></td>
                          <td style="width:80px;">姓名:</td>
                          <td style="width:150px;"><input name="name" class="mini-textbox" /></td>
                          <td style="width:80px;">薪資:</td>
                          <td style="width:150px;"><input name="salary" class="mini-textbox" /></td>
                      </tr>
                      <tr>
                          <td>性別:</td>
                          <td><input name="gender" class="mini-combobox" url="mini_JSPath + '../../demo/data/genders.txt'"/></td>
                          <td>年齡:</td>
                          <td><input name="age" class="mini-spinner" minValue="0" maxValue="200" value="25"  /></td>
                          <td>出生日期:</td>
                          <td><input name="birthday" class="mini-datepicker" /></td>
                      </tr>
                      <tr>
                          <td style="text-align:right;padding-top:5px;padding-right:20px;" colspan="6">
                              <a class="Update_Button" href="javascript:updateRow()">Update</a> 
                              <a class="Cancel_Button" href="javascript:cancelRow()">Cancel</a>
                          </td>                
                      </tr>
                 
                  </table>
              </div>
          </div>
          
                     

          二:面板操作          

          彈出加載面板數(shù)據(jù):

          var editWindow = mini.get("editWindow");
          editWindow.show();
          var form = new mini.Form("#editform");
          form.loading();
          $.ajax({
              url: "../data/DataService.aspx?method=GetEmployee&id=" + row.id,
              success: function (text) {
                  var o = mini.decode(text);
                  form.setData(o);
                  form.unmask();
              },
              error: function () {
                  alert("表單加載錯(cuò)誤");
              }
          });
          
          保存提交面板數(shù)據(jù):
          var form = new mini.Form("#editform");
          var o = form.getData();
          
          grid.loading("保存中,請(qǐng)稍后......");
          var json = mini.encode([o]);
          $.ajax({
              url: "../data/DataService.aspx?method=SaveEmployees",
              data: { employees: json },
              success: function (text) {
                              
                  grid.reload();
              },
              error: function (jqXHR, textStatus, errorThrown) {
                  alert(jqXHR.responseText);
              }
          });
          
          editWindow.hide();
          
              
          posted @ 2012-11-19 22:33 nikofan 閱讀(1933) | 評(píng)論 (0)編輯 收藏

          CRUD之:行內(nèi)表單編輯
                      
                                           

          參考示例CRUD之:行內(nèi)表單編輯


                                

          一:創(chuàng)建編輯表單

          <div id="editForm1" style="display:none;padding:5px;position:relative;">
              <input class="mini-hidden" name="id"/>
              <table style="width:100%;">
                  <tr>
                      <td style="width:80px;">員工帳號(hào):</td>
                      <td style="width:150px;"><input name="loginname" class="mini-textbox" /></td>
                      <td style="width:80px;">姓名:</td>
                      <td style="width:150px;"><input name="name" class="mini-textbox" /></td>
                      <td style="width:80px;">薪資:</td>
                      <td style="width:150px;"><input name="salary" class="mini-textbox" /></td>
                  </tr>
                  <tr>
                      <td>性別:</td>
                      <td><input name="gender" class="mini-combobox" data="Genders"/></td>
                      <td>年齡:</td>
                      <td><input name="age" class="mini-spinner" minValue="0" maxValue="200" value="25"  /></td>
                      <td>出生日期:</td>
                      <td><input name="birthday" class="mini-datepicker" /></td>
                  </tr>
                  <tr>
                      <td style="text-align:right;padding-top:5px;padding-right:20px;" colspan="6">
                          <a class="Update_Button" href="javascript:updateRow();">Update</a> 
                          <a class="Cancel_Button" href="javascript:cancelRow();">Cancel</a>
                      </td>                
                  </tr>
              </table>
          </div>
          
                               

          二:嵌入詳細(xì)行          

          //顯示行詳細(xì)
          grid.hideAllRowDetail();
          grid.showRowDetail(row);
          //將editForm元素,加入行詳細(xì)單元格內(nèi)
          var td = grid.getRowDetailCellEl(row);
          td.appendChild(editForm);
          editForm.style.display = "";
          
                    

          三:加載表單           

          var form = new mini.Form("editForm1");
          if (grid.isNewRow(row)) {                    
              form.reset();
          } else {
              form.loading();
              $.ajax({
                  url: "../data/DataService.aspx?method=GetEmployee&id=" + row.id,
                  success: function (text) {
                      var o = mini.decode(text);
                      form.setData(o);                            
          
                      form.unmask();
                  }
              });
          }
          
                    

          四:提交表單 

          var form = new mini.Form("editForm1");
          var o = form.getData();           
          grid.loading("保存中,請(qǐng)稍后......");
          var json = mini.encode([o]);
          $.ajax({
              url: "../data/DataService.aspx?method=SaveEmployees",
              data: { employees: json },
              success: function (text) {
                  grid.reload();
              },
              error: function (jqXHR, textStatus, errorThrown) {
                  alert(jqXHR.responseText);
              }
          });
          
          posted @ 2012-11-16 16:03 nikofan 閱讀(547) | 評(píng)論 (0)編輯 收藏

          CRUD之:行編輯
                                 

          參考示例CRUD之:行編輯

                               

          一:創(chuàng)建單元格編輯器

          <div id="datagrid1" class="mini-datagrid" style="width:700px;height:280px;" 
              url="../data/DataService.aspx?method=SearchEmployees" 
          >
              <div property="columns">
                  <div name="action" width="120" headerAlign="center" align="center" renderer="onActionRenderer" cellStyle="padding:0;">#</div>
                  <div field="loginname" width="120" headerAlign="center" allowSort="true">員工帳號(hào)
                      <input property="editor" class="mini-textbox" />
                  </div>                
                  <div field="gender" width="100" allowSort="true" renderer="onGenderRenderer" align="center" headerAlign="center">性別
                      <input property="editor" class="mini-combobox" style="width:100%;" data="[{id:1,text:'男'}, {id:2, text: '女'}]"/>                
                  </div>            
                  <div field="age" width="100" allowSort="true">年齡
                      <input property="editor" class="mini-spinner" minValue="0" maxValue="200" value="25" style="width:100%;"/>
                  </div>
                  <div field="birthday" width="100" allowSort="true" dateFormat="yyyy-MM-dd">出生日期
                      <input property="editor" class="mini-datepicker" style="width:100%;"/>
                  </div>                                    
                  <div field="createtime" width="100" headerAlign="center" dateFormat="yyyy-MM-dd" allowSort="true">創(chuàng)建日期</div>                
              </div>
          </div>            

          比如:mini-textbox的property為"editor",表示是此列的編輯器。




                     

          二:編輯操作

          開(kāi)始編輯行:
          grid.beginEditRow(row);
          
          取消編輯:
          grid.cancelEdit();
          

          提交編輯數(shù)據(jù):

          var rowData = grid.getEditRowData(row);
          grid.loading("保存中,請(qǐng)稍后......");
          var json = mini.encode([rowData]);
          $.ajax({
              url: "../data/DataService.aspx?method=SaveEmployees",
              data: { employees: json },
              success: function (text) {
                  grid.reload();
              },
              error: function (jqXHR, textStatus, errorThrown) {
                  alert(jqXHR.responseText);
              }
          });
          
          posted @ 2012-11-14 16:32 nikofan 閱讀(4974) | 評(píng)論 (2)編輯 收藏

          CRUD之:?jiǎn)卧窬庉?/strong>
                      
           
                     
                    

          參考示例單元格編輯


                     


                     

          一:創(chuàng)建單元格編輯器

          <div id="datagrid1" class="mini-datagrid" style="width:800px;height:280px;" 
              url="../data/AjaxService.aspx?method=SearchEmployees" idField="id"
              allowResize="true" pageSize="20" 
              allowCellEdit="true" allowCellSelect="true" multiSelect="true">
              <div property="columns">
                  <div type="checkcolumn"></div>            
                  <div field="loginname" width="120" headerAlign="center" allowSort="true">員工帳號(hào)
                      <input property="editor" class="mini-textbox" style="width:100%;"/>
                  </div>                
                  <div field="gender" width="100" renderer="onGenderRenderer" align="center" headerAlign="center">性別
                      <input property="editor" class="mini-combobox" style="width:100%;" data="Genders"/>                
                  </div>
                  <div field="age" width="100" allowSort="true" >年齡
                      <input property="editor" class="mini-spinner" minValue="0" maxValue="200" value="25" style="width:100%;"/>
                  </div>
                  <div field="birthday" width="100" allowSort="true" dateFormat="yyyy-MM-dd">出生日期
                      <input property="editor" class="mini-datepicker" style="width:100%;"/>
                  </div>    
                  <div field="remarks" width="120" headerAlign="center" allowSort="true">備注
                      <input property="editor" class="mini-textarea" style="width:100%;" minHeight="80"/>
                  </div>                                 
                  <div field="createtime" width="100" headerAlign="center" dateFormat="yyyy-MM-dd" allowSort="true">創(chuàng)建日期</div>
              </div>
          </div>           

          設(shè)置allowCellEdit和allowCellSelect后,表格為單元格編輯模式。

                   

          二:編輯操作          

          增加行:

          function addRow() {
              var newRow = { name: "New Row" };
              grid.addRow(newRow, 0);
          }
          
          刪除行:
          function removeRow() {
              var rows = grid.getSelecteds();
              if (rows.length > 0) {
                  grid.removeRows(rows, true);
              }
          }
          
          保存數(shù)據(jù):
          function saveData() {
              //獲得增加、刪除、修改的記錄集合
              var data = grid.getChanges();
              var json = mini.encode(data);
              grid.loading("保存中,請(qǐng)稍后......");        
              $.ajax({
                  url: "../data/AjaxService.aspx?method=SaveChangedEmployees",
                  data: { data: json },
                  type: "post",
                  success: function (text) {
                      grid.reload();
                  },
                  error: function (jqXHR, textStatus, errorThrown) {
                      alert(jqXHR.responseText);
                  }
              });
          }
          
                    

          三:服務(wù)端處理

          public void SaveChangedEmployees()
          {
              String json = Request["data"];
              ArrayList rows = (ArrayList)PluSoft.Utils.JSON.Decode(json);
          
              foreach (Hashtable row in rows)
              {
                  //根據(jù)記錄狀態(tài),進(jìn)行不同的增加、刪除、修改操作
                  String state = row["_state"] != null ? row["_state"].ToString() : "";
                  if(state == "added")
                  {
                      row["createtime"] = DateTime.Now;
                      new TestDB().InsertEmployee(row);
                  }
                  else if (state == "removed" || state == "deleted")
                  {
                      String id = row["id"].ToString();
                      new TestDB().DeleteEmployee(id);
                  }
                  else if (state == "modified")
                  {
                      new TestDB().UpdateEmployee(row);
                  }
              }
          }
          
                     
          posted @ 2012-11-13 22:38 nikofan 閱讀(2264) | 評(píng)論 (0)編輯 收藏

          詳細(xì)行
                          
                      
                             

          參考示例詳細(xì)行

                      
                     

          表格的"showRowDetail"方法可以為一個(gè)普通表格行增加了一個(gè)詳細(xì)行。          

          通過(guò)"getRowDetailCellEl"方法獲得此詳細(xì)行的DOM元素后,可以在此詳細(xì)行DOM元素內(nèi)加入任何HTML內(nèi)容。

          function onShowRowDetail(e) {
              var grid = e.sender;
              var row = e.record;
          
              var td = grid.getRowDetailCellEl(row);
          
              $.ajax({
                  url: "../data/DataService.aspx?method=GetEmployee&id=" + row.id,
                  success: function (text) {
                      var o = mini.decode(text);
                      //生成詳細(xì)信息html
          
                      if (o.gender == 1) o.gender_name = "男";
                      else if (o.gender == 2) o.gender_name = "女";
                      else o.gender_name = "";
          
                      o.birtyday_name = o.birthday ? mini.formatDate(o.birthday, "yyyy-MM-dd") : "";
          
                      td.innerHTML = "";
                      $("#formTemplate").tmpl(o).appendTo(td); ;
                  }
              });
          }
          
          posted @ 2012-11-12 15:55 nikofan 閱讀(2527) | 評(píng)論 (0)編輯 收藏

          表格:匯總行
                          
                                

          參考示例匯總行
                     

          Javascript處理          

          通常在表格的"load"數(shù)據(jù)加載完成事件中,更新表格的匯總信息:

          grid.on("load", onGridLoad);
          
          function onGridLoad(e) {
              var result = e.result;
              var grid = e.sender;
          
              var cellEl = grid.getSummaryCellEl("ageColumn");
              cellEl.style.cssText = "text-align:right";
              cellEl.innerHTML = "<span style='color:Brown;'>"
                              + 'Min=' + result.minAge + "<br/>"
                              + 'Max=' + result.maxAge + "<br/>"
                              + 'Avg=' + result.avgAge + "<br/>"
                              + "</span>";
          
              var cellEl = grid.getSummaryCellEl("totalColumn");
              cellEl.innerHTML = "總員工數(shù):" + result.total;
          }
          
                 
                     

          服務(wù)端數(shù)據(jù)處理          

          在服務(wù)端返回表格分頁(yè)數(shù)據(jù)時(shí),我們額外增加了一些屬性,比如minAge、maxAge、avgAge等,代碼如下:

          public Hashtable SearchEmployees(string key, int index, int size, string sortField, string sortOrder)
          {        
              ArrayList employees = ......;   //分頁(yè)后的數(shù)據(jù)
              int totalCount = ......;        //總記錄數(shù)
          
              Hashtable result = new Hashtable();
              result["data"] = employees;
              result["total"] = totalCount;
          
              //生成一些匯總信息
              ArrayList ages = DBUtil.Select("select min(age) as minAge, max(age) as maxAge, avg(age) as avgAge from t_employee");
              Hashtable ageInfo = ages[0] as Hashtable;
              result["minAge"] = ageInfo["minAge"];
              result["maxAge"] = ageInfo["maxAge"];
              result["avgAge"] = ageInfo["avgAge"];
          
              return result;
          }
          
          posted @ 2012-11-09 16:07 nikofan 閱讀(4517) | 評(píng)論 (1)編輯 收藏

          表格:過(guò)濾行
                          
                               

          參考示例行過(guò)濾
                     

          一:定義過(guò)濾器         

          設(shè)置表格"showFilter"屬性為"true"后,可以在列配置對(duì)象上定義過(guò)濾器對(duì)象:

          <div field="name" width="120" headerAlign="center" allowSort="true">姓名
              <!--定義此列的過(guò)濾器對(duì)象,注意property="filter"-->
              <input id="nameFilter" property="filter" class="mini-textbox" onvaluechanged="onNameFilterChanged" style="width:100%;" />
          </div>   
                     

          二:處理"valuechanged"事件      

          在"onvaluechanged"值變化時(shí),會(huì)自動(dòng)調(diào)用一個(gè)過(guò)濾方法onNameFilterChanged。此方法由開(kāi)發(fā)者實(shí)現(xiàn),如下:

          function onNameFilterChanged(e) {
              var textbox = e.sender;
              var key = textbox.getValue();
          
              grid.load({ key: key });
          }
          
          posted @ 2012-11-08 15:46 nikofan 閱讀(4794) | 評(píng)論 (10)編輯 收藏

          表格:顯示/隱藏列
                                     

          參考示例顯示/隱藏列
                      
                     

          通過(guò)設(shè)置表格的showColumn和hideColumn方法,可以顯示、隱藏表格列。          

          給列對(duì)象設(shè)置一個(gè)name:
          <div name="loginnameColumn" field="loginname" width="120" headerAlign="center" allowSort="true">員工帳號(hào)</div>    
                     

          在運(yùn)行時(shí)調(diào)用方法顯示和隱藏列:

          //顯示列
          grid.showColumn("loginnameColumn");
          //隱藏列
          grid.hideColumn("loginnameColumn");  
          
          posted @ 2012-11-07 16:18 nikofan 閱讀(6421) | 評(píng)論 (2)編輯 收藏

          表格:鎖定列
                          
                      
                           

          參考示例鎖定列
                     
                     

          通過(guò)設(shè)置表格的frozenStartColumn和frozenEndColumn屬性,可以鎖定住表格列:

          grid.setFrozenStartColumn(0);
          grid.setFrozenEndColumn(1);
          
          posted @ 2012-11-06 16:03 nikofan 閱讀(2969) | 評(píng)論 (0)編輯 收藏

          表格:多表頭
                          
                              

          參考示例多表頭                     
                     

          通過(guò)給"column"對(duì)象設(shè)置下一級(jí)"columns"列集合對(duì)象,輕松實(shí)現(xiàn)任意層級(jí)的多表頭。如下代碼:

          <div id="datagrid1" class="mini-datagrid" style="width:700px;height:280px;" 
              url="../data/DataService.aspx?method=SearchEmployees" 
          >
              <div property="columns">
                  <div type="indexcolumn"></div>                
                  <div field="loginname" width="120" headerAlign="center" allowSort="true">員工帳號(hào)</div>    
                  <div field="name" width="120" headerAlign="center" allowSort="true">姓名</div>    
                  <div header="工作信息" headerAlign="center">
                      <!--下一級(jí)columns-->
                      <div property="columns">
                          <div width="120" headerAlign="center">部門(mén)&職務(wù)
                              <!--下一級(jí)columns-->
                              <div property="columns">
                                  <div field="dept_name" width="120">所屬部門(mén)</div>
                                  <div field="position_name" width="100">職位</div>
                              </div>
                          </div>
                          <div field="salary" width="100" allowSort="true">薪資</div>
                      </div>
                  </div>                    
              </div>
          </div>
          

                  
          posted @ 2012-11-05 16:33 nikofan 閱讀(2250) | 評(píng)論 (0)編輯 收藏

          表格:自定義單元格
                          
                      
                                

          參考示例自定義單元格

                     

          監(jiān)聽(tīng)處理"drawcell"事件         

          使用"drawcell"事件,可以自定義單元格內(nèi)容、樣式、行樣式等。

          grid.on("drawcell", function (e) {
              var record = e.record,
                  column = e.column,
                  field = e.field,
                  value = e.value;
          
              //格式化日期
              if (field == "birthday") {
                  if (mini.isDate(value)) e.cellHtml = mini.formatDate(value, "yyyy-MM-dd");
          
              }
          
              //給年齡,增加"歲"字符串
              if (field == "age") {
                  e.cellHtml = value + "歲";
              }
          
              //給帳號(hào)列,增加背景色
              if (field == "loginname") {
                  e.cellStyle = "background:#ecedef";
              }
          
              //超過(guò)1萬(wàn)工資,紅色標(biāo)識(shí)
              if (field == "salary" && value >= 10000) {
                  e.cellStyle = "color:red;font-weight:bold;";
              }
          
              //顯示學(xué)歷
              if (field == "educational") {
                  for (var i = 0, l = Educationals.length; i < l; i++) {
                      var edu = Educationals[i];
                      if (edu.id == value) {
                          e.cellHtml = edu.name;
                          break;
                      }
                  }
              }
          
              //action列,超連接操作按鈕
              if (column.name == "action") {
                  e.cellStyle = "text-align:center";
                  e.cellHtml = '<a href="javascript:edit(\'' + record.id + '\')">Edit</a>&nbsp; '
                              + '<a href="javascript:del(\'' + record.id + '\')">Delete</a>'
              }
          
              //將性別文本替換成圖片
              if (column.field == "gender") {
                  if (e.value == 1) {
                      e.cellHtml = "<span class='icon-female'></span>"
                  } else {
                      e.cellHtml = "<span class='icon-boy'></span>"
                  }
              }
          
              //設(shè)置行樣式
              if (record.gender == 1) {
                  e.rowCls = "myrow";
              }
          });
          
          posted @ 2012-11-02 15:57 nikofan 閱讀(8289) | 評(píng)論 (0)編輯 收藏

          表格:自定義列
                          
                                

          參考示例數(shù)據(jù)表格    分頁(yè)表格


                        

          表格列配置集合( columns ),是一個(gè)數(shù)組,如:[column, column, ...]。
          其中一個(gè)column的配置參數(shù)如下表:
             

             

           

          使用HTML配置方式,代碼如下

          <div id="datagrid1" class="mini-datagrid" style="width:700px;height:280px;" 
              url="../data/DataService.aspx?method=SearchEmployees"     
          >
              <div property="columns">
                  <div type="indexcolumn" ></div>
                  <div field="loginname" width="120" headerAlign="center" allowSort="true">員工帳號(hào)</div>    
                  <div field="name" width="120" headerAlign="center" allowSort="true">姓名</div>                            
                  <div field="gender" width="100" renderer="onGenderRenderer" align="center" headerAlign="center">性別</div>
                  <div field="salary" width="100" allowSort="true">薪資</div>                                    
                  <div field="age" width="100" allowSort="true">年齡</div>
                  <div field="createtime" width="100" headerAlign="center" dateFormat="yyyy-MM-dd" allowSort="true">創(chuàng)建日期</div>                
              </div>
          </div>  
             

          我們也可以使用Javascript方式,代碼如下:

          var grid = new mini.DataGrid();
          grid.set({
              url: "../data/DataService.aspx?method=SearchEmployees",
              style: "width:700px;height:280px;",
              columns: [
                  { type: "indexcolumn" },
                  { header: "員工帳號(hào)", field: "loginname", width: 120, headerAlign: "center", allowSort: true },
                  { header: "姓名", field: "name", width: 120, headerAlign: "center", allowSort: true },
                  { header: "性別", field: "gender", width: 100, align: "center", renderer: onGenderRenderer },
                  { header: "薪資", field: "salary", width: 100, allowSort: true },
                  { header: "年齡", field: "age", width: 100, allowSort: true },
                  { header: "創(chuàng)建日期", field: "createtime", width: 100, headerAlign: "center", allowSort: true, dateFormat: "yyyy-MM-dd" }
              ]
          });
          grid.render(document.body);
          
            

          Note:無(wú)論是使用Javascript還是HTML的方式創(chuàng)建表格,實(shí)現(xiàn)功能都是一樣的。
             

          posted @ 2012-11-01 16:08 nikofan 閱讀(5133) | 評(píng)論 (1)編輯 收藏

          數(shù)據(jù)表格
                     
                      
                    

          參考示例數(shù)據(jù)表格    分頁(yè)表格

                     

          一:創(chuàng)建表格

          <div id="datagrid1" class="mini-datagrid" style="width:700px;height:280px;" 
              url="../data/DataService.aspx?method=SearchEmployees"  idField="id" allowResize="true"
          >
              <div property="columns">
                  <div type="indexcolumn" ></div>
                  <div field="loginname" width="120" headerAlign="center" allowSort="true">員工帳號(hào)</div>    
                  <div field="name" width="120" headerAlign="center" allowSort="true">姓名</div>                            
                  <div field="gender" width="100" renderer="onGenderRenderer" align="center" headerAlign="center">性別</div>
                  <div field="salary" width="100" allowSort="true">薪資</div>                                    
                  <div field="age" width="100" allowSort="true">年齡</div>
                  <div field="createtime" width="100" headerAlign="center" dateFormat="yyyy-MM-dd" allowSort="true">創(chuàng)建日期</div>                
              </div>
          </div>   
                     

          二:數(shù)據(jù)加載

          條件加載:
          //從界面表單元素獲取查詢條件
          grid.load({
              name: document.getElementById("key").value, 
              date: document.getElementById("date").value
          });
          
          分頁(yè)導(dǎo)航:
          grid.gotoPage(1, 10);   //跳轉(zhuǎn)到第二頁(yè),每頁(yè)20條數(shù)據(jù)            

          字段排序:

          //對(duì)"createtime"字段,進(jìn)行降級(jí)排序
          grid.sortBy("createtime", "desc");
          

                     

          三:服務(wù)端處理

          //查詢條件
          string key = Request["name"];
          //分頁(yè)
          int pageIndex = Convert.ToInt32(Request["pageIndex"]);
          int pageSize = Convert.ToInt32(Request["pageSize"]);        
          //字段排序
          String sortField = Request["sortField"];
          String sortOrder = Request["sortOrder"];
          
          //數(shù)據(jù)庫(kù)操作:使用查詢條件、分頁(yè)、排序等參數(shù)進(jìn)行查詢
          Hashtable result = SearchEmployees(key, pageIndex, pageSize, sortField, sortOrder);
          
          //返回JSON:將查詢的結(jié)果,序列化為JSON字符串返回        
          String json = PluSoft.Utils.JSON.Encode(result);
          Response.Write(json);
          

                     

          四:數(shù)據(jù)結(jié)構(gòu)          

          在服務(wù)端處理后,獲得的JSON結(jié)構(gòu)如下:      

          {
              total: 100,     //總記錄數(shù)
               data: [         //分頁(yè)后的數(shù)組數(shù)據(jù)
                   { ... },
                  { ... },
                  ...
              ]
          }
          
          posted @ 2012-10-31 16:31 nikofan 閱讀(8423) | 評(píng)論 (2)編輯 收藏

          FileUpload:文件上傳控件
                          
                      
                   

          參考示例FileUpload:文件上傳控件

                              

          創(chuàng)建FileUpload  

          <input id="fileupload1" class="mini-fileupload" name="Fdata" limitType="*.txt" 
              flashUrl="swfupload/swfupload.swf"
              uploadUrl="upload.aspx"
              onuploadsuccess="onUploadSuccess"
              />
                     

          服務(wù)端處理

          // 獲得程序路徑
          string tempFile = Request.PhysicalApplicationPath;
          
          //找到目標(biāo)文件對(duì)象
          HttpPostedFile uploadFile = Request.Files["Fdata"];
          
          // 如果有文件, 則保存到一個(gè)地址
          if (uploadFile.ContentLength > 0)
          {
              uploadFile.SaveAs(string.Format("{0}{1}{2}", tempFile, "demo\\fileUpload\\upload\\", uploadFile.FileName));
          }
          
          Response.Write(uploadFile.FileName +"("+DateTime.Now+")");    //可以返回一個(gè)JSON字符串, 在客戶端做更多處理
          
             
          posted @ 2012-10-31 09:27 nikofan 閱讀(9605) | 評(píng)論 (3)編輯 收藏

          CheckBoxList:復(fù)選框組
                          
                      
                             

          參考示例CheckBoxList:復(fù)選框組

                    
                     

          創(chuàng)建CheckBoxList 

          <div id="cbl1" class="mini-checkboxlist" repeatItems="3" repeatLayout="table"
              textField="text" valueField="id" value="cn,usa" onload="onLoad"
              url="../data/countrys.txt" >
          </div>
                     

          數(shù)據(jù)結(jié)構(gòu)

          [
              { id: "usa", text: "美國(guó)" },
              { id: "cn", text: "中國(guó)" },
              { id: "jp", text: "日本" },
              { id: "en", text: "英國(guó)" },
              { id: "de", text: "德國(guó)" },
              { id: "fr", text: "法國(guó)" },
              { id: "ca", text: "加拿大" },
              { id: "at", text: "奧地利" },
              { id: "ch", text: "瑞士" }
          ]
          

             
          posted @ 2012-10-26 16:45 nikofan 閱讀(2641) | 評(píng)論 (0)編輯 收藏

          ListBox:列表控件




          參考示例ListBox:列表控件


          創(chuàng)建ListBox

          <div id="listbox1" class="mini-listbox" style="width:150px;height:100px;"
              textField="text" valueField="id" 
              url="../data/countrys.txt">
          </div>
          

          多列

          <div id="listbox2" class="mini-listbox" style="width:400px;height:120px;" 
              value="cn" onvaluechanged="onListBoxValueChanged" 
              url="../data/countrys.txt" showCheckBox="true" multiSelect="true" >     
              <div property="columns">
                  <div header="ID" field="id"></div>
                  <div header="國(guó)家" field="text"></div>
              </div>
          </div>
          
          posted @ 2012-10-25 16:39 nikofan 閱讀(2759) | 評(píng)論 (0)編輯 收藏

          CheckBox:復(fù)選框
                          
                      
                               

          參考示例CheckBox:復(fù)選框            

                     

          創(chuàng)建CheckBox  

          <div id="ck1" name="product" class="mini-checkbox" checked="true" text="MiniUI CheckBox" ></div>
          



                 

                     
                 

             
          posted @ 2012-10-24 16:07 nikofan 閱讀(4044) | 評(píng)論 (0)編輯 收藏

          TextBoxList:多選輸入智能提示框
                          
                      
                             

          參考示例TextBoxList:多選輸入智能提示框

                     
                     

          創(chuàng)建TextBoxList

          <input id="tbl1" class="mini-textboxlist" required="true" style="width:250px;"
                  url="../data/DataService.aspx?method=FilterCountrys" value="cn,usa" text="中國(guó),美國(guó)"
                  valueField="id" textField="text" onvaluechanged="onValueChanged"/>

                     

          數(shù)據(jù)結(jié)構(gòu)

          [
              { id: "usa", text: "美國(guó)" },
              { id: "cn", text: "中國(guó)" },
              { id: "jp", text: "日本" },
              { id: "en", text: "英國(guó)" },
              { id: "de", text: "德國(guó)" },
              { id: "fr", text: "法國(guó)" },
              { id: "ca", text: "加拿大" },
              { id: "at", text: "奧地利" },
              { id: "ch", text: "瑞士" }
          ]
          
          posted @ 2012-10-23 16:25 nikofan 閱讀(2564) | 評(píng)論 (1)編輯 收藏

          AutoComplete:輸入智能提示框
                          
                              
                     

          參考示例AutoComplete:輸入智能提示框          
                     

          創(chuàng)建AutoComplete

              <input id="tbl1" class="mini-autocomplete" required="true" style="width:200px;" valueField="id" textField="text" url="../data/DataService.aspx?method=FilterCountrys2" value="cn" text="中國(guó)" />

                     

          數(shù)據(jù)結(jié)構(gòu)

          [
              { id: "usa", text: "美國(guó)" },
              { id: "cn", text: "中國(guó)" },
              { id: "jp", text: "日本" },
              { id: "en", text: "英國(guó)" },
              { id: "de", text: "德國(guó)" },
              { id: "fr", text: "法國(guó)" },
              { id: "ca", text: "加拿大" },
              { id: "at", text: "奧地利" },
              { id: "ch", text: "瑞士" }
          ]
          
          posted @ 2012-10-22 16:07 nikofan 閱讀(3159) | 評(píng)論 (1)編輯 收藏

          TreeSelect:樹(shù)形選擇框
                          
                               
                     

          參考示例: TreeSelect:樹(shù)形選擇框

                     

          創(chuàng)建TreeSelect

              <input id="select1" class="mini-treeselect" url="../data/listTree.txt" textField="text" valueField="id" parentField="pid" />

                     

          數(shù)據(jù)結(jié)構(gòu)

          [
              {id: "base", text: "Base", expanded: false},
              
              {id: "ajax", text: "Ajax", pid: "base"},
              {id: "json", text: "JSON", pid: "base"},
              {id: "date", text: "Date", pid: "base"},
              {id: "control", text: "Control", pid: "base"},
          
              {id: "forms", text: "Forms", expanded: false},
              
              {id: "button", text: "Button", pid: "forms"},
              {id: "listbox", text: "ListBox", pid: "forms"},
              {id: "checkboxlist", text: "CheckBoxList", pid: "forms"},
              
              {id: "lists", text: "Lists", expanded: false},
              
              {id: "datagrid", text: "DataGrid", pid: "lists"},            
              {id: "tree", text: "Tree", pid: "lists"},
              {id: "treegrid", text: "TreeGrid ", pid: "lists"},
          
              {id: "layouts", text: "Layouts", expanded: false},
              
              {id: "panel", text: "Panel", pid: "layouts"},
              {id: "splitter", text: "Splitter", pid: "layouts"},
              {id: "layout", text: "Layout ", pid: "layouts"},
          
              {id: "navigations", text: "Navigations", expanded: false},
                  
              {id: "pager", text: "Pager", pid: "navigations"},
              {id: "tabs", text: "Tabs", pid: "navigations"},
              {id: "navbar", text: "OutlookBar", pid: "navigations"},
              {id: "menu", text: "Menu", pid: "navigations"}
          
          ]
          
          posted @ 2012-10-19 16:56 nikofan 閱讀(5449) | 評(píng)論 (0)編輯 收藏

          Spinner:數(shù)字輸入框
                          
                                 

          參考示例Spinner:數(shù)字輸入框          

                     

          創(chuàng)建Spinner

          <input id="sp1" class="mini-spinner"  minValue="200" maxValue="250"/>
          


                     
                 

                     
                 

             
          posted @ 2012-10-18 16:52 nikofan 閱讀(4240) | 評(píng)論 (0)編輯 收藏

          DatePicker:日期選擇框
                          
                      
                                

          參考示例DatePicker:日期選擇框

                     

          創(chuàng)建DatePicker        

          只需要一個(gè)id即可創(chuàng)建表單對(duì)象:     

          <input id="date1" class="mini-datepicker"  />
                   

          Date & Time

          <input id="date2" class="mini-datepicker" style="width:200px;" format="yyyy-MM-dd H:mm" showTime="true" />
          
              
             
          posted @ 2012-10-17 16:35 nikofan 閱讀(4895) | 評(píng)論 (0)編輯 收藏

          ComboBox:聯(lián)動(dòng)選擇
                          
                              
                  

          參考示例ComboBox:聯(lián)動(dòng)選擇

                               

          一:創(chuàng)建兩個(gè)ComboBox 

          <span>部門(mén)</span><br />
          <input id="deptCombo" class="mini-combobox" style="width:150px;" textField="name" valueField="id" 
              onvaluechanged="onDeptChanged" url="../data/DataService.aspx?method=GetDepartments"
              showNullItem="true"
                  />         
          <br /><br />
          <span>職位</span><br />
          <input id="positionCombo" class="mini-combobox" style="width:150px;" textField="name" valueField="id" />  
                     

          二:valuechanged加載第二個(gè)ComboBox

          function onDeptChanged(e) {
              var id = deptCombo.getValue();
              positionCombo.setValue("");
              var url = "../data/DataService.aspx?method=GetPositionsByDepartmenId&id=" + id
              positionCombo.setUrl(url);            
          }
          
          posted @ 2012-10-16 16:50 nikofan 閱讀(3988) | 評(píng)論 (0)編輯 收藏

          ComboBox:下拉選擇框
                          
                     
                                          

          參考示例ComboBox:下拉選擇框

                                

          創(chuàng)建ComboBox

          <input id="combo1" class="mini-combobox" style="width:150px;" textField="text" valueField="id" 
              url="../data/countrys.txt" value="cn" showNullItem="true" /> 
                     

          多選 + 多列

          <div class="mini-combobox" style="width:250px;"  popupWidth="400" textField="text" valueField="id" 
              url="../data/countrys.txt" value="cn,usa" multiSelect="true"  >     
              <div property="columns">
                  <div header="ID" field="id"></div>
                  <div header="國(guó)家" field="text"></div>
              </div>
          </div>
          
          posted @ 2012-10-15 16:33 nikofan 閱讀(8800) | 評(píng)論 (2)編輯 收藏

          TextBox:文本輸入框
                          
                      
                              

          參考示例TextBox:文本輸入框


                              

          創(chuàng)建代碼

          單行輸入框:<input class="mini-textbox" value="0" /> <br /><br />
          密碼輸入框:<input class="mini-password" value="12345"  /> <br /><br />
          多行輸入框:<input class="mini-textarea" value="中國(guó)"  /> <br />
           
          posted @ 2012-10-12 16:45 nikofan 閱讀(4671) | 評(píng)論 (3)編輯 收藏

          ButtonEdit:按鈕輸入框

                      
                     

          參考示例
                          ButtonEdit:按鈕輸入框    
                          彈出面板    
                          彈出選擇樹(shù)
                
                     

          創(chuàng)建ButtonEdit

          <input id="btnEdit1" class="mini-buttonedit" onbuttonclick="onButtonEdit"/>
                     

          buttonclick事件

          $.ajax({
              url: "../data/FormService.aspx?method=LoadData",
              type: "post",
              success: function (text) {
                  var data = mini.decode(text);   //反序列化成對(duì)象
                  form.setData(data);             //設(shè)置多個(gè)控件數(shù)據(jù)
              }
          });
          
                    

          提交表單

          function onButtonEdit(e) {
              alert("彈出選擇");
          }
          

             
          posted @ 2012-10-11 16:52 nikofan 閱讀(2513) | 評(píng)論 (0)編輯 收藏

          主站蜘蛛池模板: 旬邑县| 台北市| 辉县市| 长武县| 固阳县| 滨海县| 丰都县| 梅河口市| 洛南县| 元朗区| 崇礼县| 廊坊市| 云龙县| 玛多县| 滕州市| 北安市| 平罗县| 南召县| 广西| 邹平县| 将乐县| 中江县| 城步| 拜泉县| 宝丰县| 噶尔县| 文化| 福鼎市| 图木舒克市| 甘谷县| 濮阳市| 来宾市| 峨眉山市| 昭苏县| 鄂托克前旗| 寻乌县| 开平市| 崇仁县| 祁门县| 华池县| 十堰市|