grid

          grid

            BlogJava :: 首頁 :: 聯(lián)系 :: 聚合  :: 管理
            78 Posts :: 0 Stories :: 62 Comments :: 0 Trackbacks
          表格:匯總行
                          
                                

          參考示例匯總行
                     

          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ù)端返回表格分頁數(shù)據(jù)時,我們額外增加了一些屬性,比如minAge、maxAge、avgAge等,代碼如下:

          public Hashtable SearchEmployees(string key, int index, int size, string sortField, string sortOrder)
          {        
              ArrayList employees = ......;   //分頁后的數(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 on 2012-11-09 16:07 nikofan 閱讀(4517) 評論(1)  編輯  收藏

          Feedback

          # re: jQuery MiniUI 開發(fā)教程 表格控件 表格:匯總行(八)[未登錄] 2015-09-25 11:40 111
          33  回復(fù)  更多評論
            


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


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 安泽县| 浦北县| 静海县| 东平县| 通河县| 黄冈市| 岳普湖县| 抚松县| 旌德县| 思茅市| 南丹县| 慈利县| 衡南县| 博兴县| 宿州市| 公主岭市| 宿迁市| 互助| 西充县| 漳州市| 六枝特区| 祁门县| 九龙城区| 永新县| 崇文区| 揭东县| 胶州市| 凤翔县| 和龙市| 荣昌县| 佛学| 馆陶县| 台州市| 大荔县| 彰武县| 安国市| 鞍山市| 南投市| 黄大仙区| 宽城| 定结县|