grid

          grid

            BlogJava :: 首頁 :: 聯(lián)系 :: 聚合  :: 管理
            78 Posts :: 0 Stories :: 62 Comments :: 0 Trackbacks
          數(shù)據(jù)表格
                     
                      
                    

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

                     

          一:創(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">員工帳號</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
          });
          
          分頁導航:
          grid.gotoPage(1, 10);   //跳轉(zhuǎn)到第二頁,每頁20條數(shù)據(jù)            

          字段排序:

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

                     

          三:服務端處理

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

                     

          四:數(shù)據(jù)結構          

          在服務端處理后,獲得的JSON結構如下:      

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

          Feedback

          # re: jQuery MiniUI 開發(fā)教程 表格控件 表格:分頁查詢(一)[未登錄] 2012-11-02 11:08 amao
          jQuery MiniUI 貌似不開源。  回復  更多評論
            

          # re: jQuery MiniUI 開發(fā)教程 表格控件 表格:分頁查詢(一) 2014-08-30 09:24 宇峰
          @amao
          是啊,內(nèi)部的觸發(fā)事件無法調(diào)用啊,誰知道怎么弄?  回復  更多評論
            


          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導航:
           
          主站蜘蛛池模板: 阜南县| 菏泽市| 靖边县| 达州市| 宁国市| 龙州县| 明水县| 泰宁县| 宜城市| 会宁县| 观塘区| 永昌县| 阜阳市| 河北省| 元谋县| 同江市| 灵石县| 中江县| 农安县| 肇庆市| 灵丘县| 周口市| 姚安县| 镇沅| 婺源县| 桐梓县| 汉源县| 格尔木市| 东阿县| 石渠县| 白水县| 富源县| 高台县| 彰化市| 阜康市| 苍溪县| 高青县| 忻州市| 贵州省| 郎溪县| 麻阳|