From 8c901078fb2799761ff5d1e5fa6fa302a2236eb1 Mon Sep 17 00:00:00 2001 From: bs2004 Date: Fri, 22 May 2015 12:31:48 +0800 Subject: [PATCH] =?UTF-8?q?v1.36=20=202015-05-22=20=E4=BD=93=E9=AA=8C?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1,禁止拖动表头改变列宽时选中表头文本; 2,修改表格渲染数据支持返回非最后一页数据行数不等于pageSize的异常情况,考虑的是集群大数据情况下数据可能不正常; 3,定义了一个全局的alert方法$.bsgrid.alert(msg),方便被用于重写; 4,grid.extend.js代码优化; 5,修复Firefox下表头拖动bug,并优化拖动体验; 6,表底聚合增加自定义聚合,示例:w_agg="custom,countXhMultId",custom表示自定义,逗号后面的表示自定义聚合函数; --- CHANGE-LOG | 11 + builds/images/skins/access/bg.gif | Bin 82 -> 83 bytes builds/images/skins/access/readme | 2 +- builds/images/skins/blue/bg.gif | Bin 904 -> 308 bytes builds/images/skins/blue/readme | 2 +- builds/images/skins/easyui/bg.gif | Bin 106 -> 121 bytes builds/images/skins/easyui/readme | 2 +- builds/images/skins/flexigrid/bg.gif | Bin 854 -> 117 bytes builds/images/skins/flexigrid/readme | 2 +- builds/images/skins/gray/bg.gif | Bin 854 -> 117 bytes builds/images/skins/gray/readme | 2 +- builds/images/skins/sky_blue/bg.gif | Bin 554 -> 508 bytes builds/images/skins/sky_blue/readme | 2 +- builds/js/grid.extend.min.js | 2 +- builds/js/grid.min.js | 2 +- builds/js/grid.paging.min.js | 2 +- builds/js/util.min.js | 2 +- builds/merged/bsgrid.all.min.js | 8 +- builds/merged/form.all.min.js | 2 +- builds/merged/grid.all.min.js | 8 +- builds/merged/grid.simple.min.js | 4 +- examples/grid/foot.html | 14 +- examples/grid/load-time-test.html | 2 +- examples/grid/move-column-custom.html | 23 +- examples/grid/standard.html | 2 +- examples/grid/standard.zh-CN.html | 2 +- examples/zh-CN-table.html | 2 +- examples/zh-CN.html | 2 +- sources/images/skins/access/bg.gif | Bin 82 -> 83 bytes sources/images/skins/access/readme | 2 +- sources/images/skins/blue/bg.gif | Bin 904 -> 308 bytes sources/images/skins/blue/readme | 2 +- sources/images/skins/easyui/bg.gif | Bin 106 -> 121 bytes sources/images/skins/easyui/readme | 2 +- sources/images/skins/flexigrid/bg.gif | Bin 854 -> 117 bytes sources/images/skins/flexigrid/readme | 2 +- sources/images/skins/gray/bg.gif | Bin 854 -> 117 bytes sources/images/skins/gray/readme | 2 +- sources/images/skins/sky_blue/bg.gif | Bin 554 -> 508 bytes sources/images/skins/sky_blue/readme | 2 +- sources/js/grid.extend.js | 308 ++++++++++++-------------- sources/js/grid.js | 30 ++- sources/js/grid.paging.js | 17 +- sources/js/util.js | 11 +- 44 files changed, 267 insertions(+), 211 deletions(-) diff --git a/CHANGE-LOG b/CHANGE-LOG index 4dd935f..e98eef4 100644 --- a/CHANGE-LOG +++ b/CHANGE-LOG @@ -1,3 +1,14 @@ +v1.36 2015-05-22 体验优化 + +1,禁止拖动表头改变列宽时选中表头文本; +2,修改表格渲染数据支持返回非最后一页数据行数不等于pageSize的异常情况,考虑的是集群大数据情况下数据可能不正常; +3,定义了一个全局的alert方法$.bsgrid.alert(msg),方便被用于重写; +4,grid.extend.js代码优化; +5,修复Firefox下表头拖动bug,并优化拖动体验; +6,表底聚合增加自定义聚合,示例:w_agg="custom,countXhMultId",custom表示自定义,逗号后面的表示自定义聚合函数; + + + v1.35 2015-04-28 性能优化、功能增强 1,优化grid及grid.extend的性能(减少非配置必须的js执行,一千条数据加载速度快一倍多); diff --git a/builds/images/skins/access/bg.gif b/builds/images/skins/access/bg.gif index b67a54e2b2bc66b5664b356d32e8610437bede20..cfa964d1b1a0e7dacf707a304bb91947fc80cabe 100644 GIT binary patch literal 83 zcmZ?wbhEHbWMW8RIK<9iY3plg>u2Qu2Q%=lGBD_X2#{I^ gX7Pwrw|{;oJlpr0y*T@uEkUC%C3D`3nG6ip0Oj`;R{#J2 diff --git a/builds/images/skins/access/readme b/builds/images/skins/access/readme index b53fee7..da3438a 100644 --- a/builds/images/skins/access/readme +++ b/builds/images/skins/access/readme @@ -1,2 +1,2 @@ Image From -bg.gif ExtJS: ext-3.4.0\resources\images\access\toolbar\bg.gif \ No newline at end of file +bg.gif ExtJS: ext-3.4.0\resources\images\access\toolbar\bg.gif modify by GIMP \ No newline at end of file diff --git a/builds/images/skins/blue/bg.gif b/builds/images/skins/blue/bg.gif index 0b085bf24e173f7a2568c347f3245bdaade1579b..4fe9fa03c128e3bdd0fef0eb7c5fa46f18bc2188 100644 GIT binary patch delta 218 zcmeBR-@?S>?&)S>naISD!mw0vB2P;Fe_8?^1|R_0#lRMM;QVptFC~4leUmn4TFsud zLd|(?kl_v2H&2^hRPBGT!6HUu_W9JNs^XDii8?Y^0{}!rjx_)P literal 904 zcmZ?wbhEHbWMZ&jXlGzJdGqb5TR`;g^zCwCTzUXRA1^)paQWfKD-So0~;Fd71bH3SrYvH+d-pFs!YKv14w;7Da~Z1~~up_!du)~evahJ_E= zc%_Uy&NM7kYU38y$=KqsP`Q;;Sgxby!h)1$R&Ie6E(r^kHZrktoKP`HXkcJuWMa6% p$*}A^6FZ-Z#4LwKrYSs=j0zqwFtu<5D0@r@Sh(uyYDPu|YXAnXewY9N diff --git a/builds/images/skins/blue/readme b/builds/images/skins/blue/readme index 4a79f1d..491e402 100644 --- a/builds/images/skins/blue/readme +++ b/builds/images/skins/blue/readme @@ -1,2 +1,2 @@ Image From -bg.gif ExtJS: ext-3.4.0\resources\images\default\toolbar\bg.gif \ No newline at end of file +bg.gif ExtJS: ext-3.4.0\resources\images\default\toolbar\bg.gif modify by GIMP \ No newline at end of file diff --git a/builds/images/skins/easyui/bg.gif b/builds/images/skins/easyui/bg.gif index 07c15c4bcb364477e6fba9e082995c6e5316dc6a..275b0b08562f9d4ba0a56ae99e7b6c44fd926f2e 100644 GIT binary patch delta 69 zcmV-L0J{Hbc?m~JMmRZP0sv%@2|G1p000Co5Xniay*TSzy8mEU5M*hdXeq30>k2_E b&of}(cn%DF@BagXa7Zi~4Tq#M836!0GK&}* delta 54 zcmb=-;&k_Pv#?BLVlbJ=X{~0$z`!CeaME-2-YqZAn*L1q!I|R8meIwObDFP!N4g~U KvU{BigEaunbP^f> diff --git a/builds/images/skins/easyui/readme b/builds/images/skins/easyui/readme index fdc6029..cebd67b 100644 --- a/builds/images/skins/easyui/readme +++ b/builds/images/skins/easyui/readme @@ -1,7 +1,7 @@ From: EasyUI 1.2.6 path: jquery-easyui-1.2.6.zip/themes/gray/images/ -bg.gif datagrid_header_bg.gif twice enlarged by GIMP +bg.gif datagrid_header_bg.gif modify by GIMP layout_button_right.gif pagination_first.gif pagination_last.gif diff --git a/builds/images/skins/flexigrid/bg.gif b/builds/images/skins/flexigrid/bg.gif index 9ab78a2ec788d6dfbbcd6212a4d3b1d9917d55e7..8d74bac771017af19b877477d4a6c5deaa2bb5a9 100644 GIT binary patch delta 88 zcmcb{R?6e<>1JV>$i$Gs@R)ldkE+XmB%s3p1RyB}7A=7jlB?D#y|&%;-bJG?F>&6q hh3not+^45>z9i}Xwngu2-v2+apuj^%s$P)68UV@dDAxc0 literal 854 zcmZ?wbhEHbWMZ&jXlGz}_Uzg7=g(ifc=7V(%U7>ny?*`r&6_uG-@bkK?%n(M?>~I_ z@c;jRhEXsY0>d-}6o0Y+efFP02jo9co?zfGW)Rn5a1d~4Xl7*5h_P7kkby}+S!_nc jfrg{q>_&192R0@*^>d1J$arpAa&odp@G2Wg0S0RTW*Ik7 diff --git a/builds/images/skins/flexigrid/readme b/builds/images/skins/flexigrid/readme index 7adf982..e44376c 100644 --- a/builds/images/skins/flexigrid/readme +++ b/builds/images/skins/flexigrid/readme @@ -1,2 +1,2 @@ Image From -bg.gif Flexigrid: flexigrid-1.1\css\images\bg.gif \ No newline at end of file +bg.gif Flexigrid: flexigrid-1.1\css\images\bg.gif modify by GIMP \ No newline at end of file diff --git a/builds/images/skins/gray/bg.gif b/builds/images/skins/gray/bg.gif index 9ab78a2ec788d6dfbbcd6212a4d3b1d9917d55e7..7e19bed62c408065a1450b7b16bd874c067b959f 100644 GIT binary patch delta 88 zcmcb{R?6e<>1JV>$i$Gs@R)ldkE+XmB%s3p1RyB}7A*k}fmLgjUfb^a@1oJ?nmNsF h)jIdr+dOp67be}`w&;D$`~L?P6nN-J)eACM0|1*UCuslx literal 854 zcmZ?wbhEHbWMZ&jXlGz}_Uzg7=g(ifc=7V(%U7>ny?*`r&6_uG-@bkK?%n(M?>~I_ z@c;jRhEXsY0>d-}6o0Y+efFP02jo9co?zfGW)Rn5a1d~4Xl7*5h_P7kkby}+S!_nc jfrg{q>_&192R0@*^>d1J$arpAa&odp@G2Wg0S0RTW*Ik7 diff --git a/builds/images/skins/gray/readme b/builds/images/skins/gray/readme index 86e45cf..b5bec86 100644 --- a/builds/images/skins/gray/readme +++ b/builds/images/skins/gray/readme @@ -1,2 +1,2 @@ Image From -bg.gif ExtJS: ext-3.4.0\resources\images\gray\toolbar\bg.gif \ No newline at end of file +bg.gif ExtJS: ext-3.4.0\resources\images\gray\toolbar\bg.gif modify by GIMP \ No newline at end of file diff --git a/builds/images/skins/sky_blue/bg.gif b/builds/images/skins/sky_blue/bg.gif index 430aa2451a0dfbf9e167a671312c8d87b44a606d..eacaa2b51bd6c60a6f8afbf390b0d246f6083ed5 100644 GIT binary patch delta 257 zcmZ3*@`stn-P6s&GLexXh2a>}MjkfC`u_t5bQl;IvKc^bVPH>eFf?{Dx3RYNQi61z%GE0S5^QSy>SgadGC?M%w&R f?_I-KK6^_^as6Qb#rDUZ^*;yGHUS3%0S0RT1?g[1]:""}})}if(a("#"+c.gridId+" thead tr:last th["+c.settings.colsProperties.checkAttr+"!='']").length==0){delete c.settings.extend.initGridMethods.initGridCheck;delete c.settings.extend.renderPerColumnMethods.renderCheck;delete c.settings.extend.afterRenderGridMethods.addCheckChangedEvent}if(!c.settings.extend.settings.supportGridEdit){delete c.settings.extend.renderPerColumnMethods.renderForm;delete c.settings.extend.afterRenderGridMethods.addGridEditEvent}if(!c.settings.extend.settings.supportColumnMove){delete c.settings.extend.initGridMethods.initColumnMove}if(!c.settings.extend.settings.fixedGridHeader){delete c.settings.extend.initGridMethods.fixedHeader;delete c.settings.extend.afterRenderGridMethods.fixedHeader}if(a.trim(c.settings.extend.settings.searchConditionsContainerId)==""){delete c.settings.extend.initGridMethods.initSearchConditions}if(a("#"+c.gridId+" tfoot td["+c.settings.colsProperties.aggAttr+"!='']").length==0){delete c.settings.extend.afterRenderGridMethods.aggregation}});a.fn.bsgrid.extendOtherMethods.fixedHeader=function(b,c){if(a.trim(a("#"+c.gridId+"_fixedDiv").data("fixedGridLock"))=="lock"){return}a("#"+c.gridId+"_fixedDiv").data("fixedGridLock","lock");var e=a("#"+c.gridId+" thead tr").length;if(!b){e=e/2;a("#"+c.gridId+" thead tr:lt("+e+")").remove()}var d=f(c.settings.extend.settings.fixedGridHeight);if(d');a("#"+b+"_fixedDiv").data("fixedGridLock","");a("#"+b+"_fixedDiv").css({padding:0,"border-width":0,width:"98%","overflow-y":"auto","margin-bottom":"-1px"});a("#"+b).css({width:"auto"});a("#"+b+"_pt_outTab").css({"border-top-width":"1px"});a.fn.bsgrid.extendOtherMethods.fixedHeader(true,c);a(window).resize(function(){a.fn.bsgrid.extendOtherMethods.fixedHeader(false,c)})});a.bsgrid.forcePushPropertyInObject(a.fn.bsgrid.defaults.extend.afterRenderGridMethods,"fixedHeader",function(d,c,b){a.fn.bsgrid.extendOtherMethods.fixedHeader(false,b)});a.fn.bsgrid.extendInitGrid.bindExtendMethods=function(b,c){var d=a.fn.bsgrid.getGridObj(b);if(a("#"+c.gridId+" thead tr:last th["+c.settings.colsProperties.checkAttr+"!='']").length!=0){d.getCheckedRowsIndexs=function(){return a.fn.bsgrid.defaults.extend.getCheckedRowsIndexs(c)};d.getCheckedRowsRecords=function(){return a.fn.bsgrid.defaults.extend.getCheckedRowsRecords(c)}}if(c.settings.extend.settings.supportGridEdit){d.activeGridEditMode=function(){return a.fn.bsgrid.defaults.extend.activeGridEditMode(c)};d.getChangedRowsIndexs=function(){return a.fn.bsgrid.defaults.extend.getChangedRowsIndexs(c)};d.getChangedRowsOldRecords=function(){return a.fn.bsgrid.defaults.extend.getChangedRowsOldRecords(c)};d.getRowsChangedColumnsValue=function(){return a.fn.bsgrid.defaults.extend.getRowsChangedColumnsValue(c)}}};a.bsgrid.forcePushPropertyInObject(a.fn.bsgrid.defaults.extend.initGridMethods,"bindExtendMethods",a.fn.bsgrid.extendInitGrid.bindExtendMethods);a.fn.bsgrid.extendInitGrid.initGridCheck=function(b,c){a.fn.bsgrid.getGridHeaderObject(c).each(function(d){if(c.columnsModel[d].check=="true"){if(a.trim(a(this).html())==""){a(this).html('')}a(this).find("input[type=checkbox]").change(function(){var e=a.bsgrid.adaptAttrOrProp(a(this),"checked")?true:false;a.bsgrid.adaptAttrOrProp(a("#"+b+" tbody tr td:nth-child("+(d+1)+")>input[type=checkbox]"),"checked",e)})}})};a.bsgrid.forcePushPropertyInObject(a.fn.bsgrid.defaults.extend.initGridMethods,"initGridCheck",a.fn.bsgrid.extendInitGrid.initGridCheck);a.fn.bsgrid.extendInitGrid.initSearchConditions=function(b,c){var e=new StringBuilder();e.append('");e.append(" ");e.append('');a("#"+c.settings.extend.settings.searchConditionsContainerId).html(e.toString());a("#"+c.settings.extend.settings.searchConditionsContainerId+" select.bsgrid_conditions_select").change(function(){a(this).next("input.bsgrid_conditions_input").attr("name",a(this).val())}).trigger("change")};a.bsgrid.forcePushPropertyInObject(a.fn.bsgrid.defaults.extend.initGridMethods,"initSearchConditions",a.fn.bsgrid.extendInitGrid.initSearchConditions);a.fn.bsgrid.extendInitGrid.initColumnMove=function(c,d){if(a("#"+d.gridId+" thead tr").length!=1){return}a("#"+d.gridId).css({"table-layout":"fixed"});var e=a.fn.bsgrid.getGridHeaderObject(d);var b=e.length;e.each(function(g){var h=this;a(h).mousedown(function(){f(h,g,b)});a(h).mousemove(function(){var q=a(h).offset().left;var n=0,o=0;if(g!=b-1){n=a(h).next();o=n.offset().left}var p=h;if(g!=b-1&&event.clientX-o>-10){p=n}if((g!=0&&event.clientX-q<10)||(g!=b-1&&event.clientX-o>-10)){a(h).css({cursor:"e-resize"});if(a.trim(a(h).data("ex_mousedown"))!="mousedown"){return}var l=a(p).width();var m=l-event.clientX+a(p).offset().left;var k=a(p).prev().width();var i=k+event.clientX-a(p).offset().left;if(parseInt(m)>19&&parseInt(i)>19){a(p).width(m).prev().width(i)}}else{a(p).css({cursor:"default"});j(h,g,b)}});a(h).mouseup(function(){j(h,g,b)});a(h).mouseout(function(){var i=a(h).offset();if(i.top>event.clientY||i.top+a(h).height()'}}return false};a.bsgrid.forcePushPropertyInObject(a.fn.bsgrid.defaults.extend.renderPerColumnMethods,"renderCheck",a.fn.bsgrid.extendRenderPerColumn.renderCheck);a.fn.bsgrid.extendRenderPerColumn.renderForm=function(c,f,i,b,e,j){if(f'}else{if(h=="text"||h=="hidden"||h=="password"||h=="radio"||h=="button"){return g+''}else{if(h=="textarea"){return g+'"}}}}return false};a.bsgrid.forcePushPropertyInObject(a.fn.bsgrid.defaults.extend.renderPerColumnMethods,"renderForm",a.fn.bsgrid.extendRenderPerColumn.renderForm);a.bsgrid.forcePushPropertyInObject(a.fn.bsgrid.defaults.extend.afterRenderGridMethods,"renderLineNumber",function(d,c,b){a.fn.bsgrid.getGridHeaderObject(b).each(function(f){var e=b.columnsModel[f].lineNumber;if(e=="line"||e=="total_line"){a("#"+b.gridId+" tbody tr:lt("+b.curPageRowsNum+") td:nth-child("+(f+1)+")").each(function(g){a(this).html((e=="line")?(g+1):(g+b.startRow))})}})});a.fn.bsgrid.extendAfterRenderGrid.addCheckChangedEvent=function(d,c,b){a.fn.bsgrid.getGridHeaderObject(b).each(function(e){if(b.columnsModel[e].checkAttr=="true"){var g=a(this).find("input[type=checkbox]");var f=a("#"+b.gridId+" tbody tr td:nth-child("+(e+1)+")>input[type=checkbox]");f.change(function(){var h=a.bsgrid.adaptAttrOrProp(g,"checked")?true:false;if(!h&&f.filter(":checked").length==f.length){a.bsgrid.adaptAttrOrProp(g,"checked",true)}else{if(h&&f.filter(":checked").length!=f.length){a.bsgrid.adaptAttrOrProp(g,"checked",false)}}})}})};a.bsgrid.forcePushPropertyInObject(a.fn.bsgrid.defaults.extend.afterRenderGridMethods,"addCheckChangedEvent",a.fn.bsgrid.extendAfterRenderGrid.addCheckChangedEvent);a.fn.bsgrid.extendAfterRenderGrid.addGridEditEvent=function(e,c,b){a("#"+b.gridId+" tbody tr:lt("+b.curPageRowsNum+")").each(function(f){var g=this;var h=b.columnsModel;a(g).find("td").each(function(i){if(h[i].edit!=""){a(this).find(".bsgrid_editgrid_checkbox, .bsgrid_editgrid_edit").change(function(){if(a.trim(a(this).val())!=a.fn.bsgrid.getGridObj(b.gridId).getColumnValue(f,h[i].index)){a(this).addClass("bsgrid_editgrid_change")}else{a(this).removeClass("bsgrid_editgrid_change")}a(g).data("change",a(g).find(".bsgrid_editgrid_change").length)})}});if(b.settings.extend.settings.supportGridEditTriggerEvent==""){a(this).find(".bsgrid_editgrid_hidden").each(function(){d(this)})}else{if(b.settings.extend.settings.supportGridEditTriggerEvent=="rowClick"){a(this).click(function(){a(this).find(".bsgrid_editgrid_hidden").each(function(){d(this)})})}else{if(b.settings.extend.settings.supportGridEditTriggerEvent=="rowDoubleClick"){a(this).dblclick(function(){a(this).find(".bsgrid_editgrid_hidden").each(function(){d(this)})})}else{if(b.settings.extend.settings.supportGridEditTriggerEvent=="cellClick"){a(this).find(".bsgrid_editgrid_hidden").each(function(){var i=this;a(i).parent("td").click(function(){d(i)})})}else{if(b.settings.extend.settings.supportGridEditTriggerEvent=="cellDoubleClick"){a(this).find(".bsgrid_editgrid_hidden").each(function(){var i=this;a(i).parent("td").dblclick(function(){d(i)})})}}}}}});function d(f){var g=a(f).removeClass("bsgrid_editgrid_hidden").clone(true);a(f).parent("td").html(g)}};a.bsgrid.forcePushPropertyInObject(a.fn.bsgrid.defaults.extend.afterRenderGridMethods,"addGridEditEvent",a.fn.bsgrid.extendAfterRenderGrid.addGridEditEvent);a.fn.bsgrid.extendAfterRenderGrid.aggregation=function(f,c,b){var e=a.fn.bsgrid.getGridObj(b.gridId);var d=b.columnsModel;a("#"+b.gridId+" tfoot tr td["+b.settings.colsProperties.aggAttr+"!='']").each(function(g){if(d[g].aggName!=""){var k=d[g].aggName;var j=null;if(k=="count"){j=b.curPageRowsNum}else{if(k=="countnotnone"||k=="sum"||k=="avg"||k=="max"||k=="min"||k=="concat"){if(k=="countnotnone"){j=0}var h=new StringBuilder();a("#"+b.gridId+" tbody tr:lt("+b.curPageRowsNum+")").each(function(i){var l=e.getColumnValue(i,d[g].aggIndex);if(l==""){}else{if(k=="countnotnone"){j=(j==null?0:j)+1}else{if(k=="sum"||k=="avg"){if(!isNaN(l)){j=(j==null?0:j)+parseFloat(l)}}else{if(k=="max"||k=="min"){if(!isNaN(l)&&(j==null||(k=="max"&&parseFloat(l)>j)||(k=="min"&&parseFloat(l)input:checked").length==1){c[c.length]=d}});return c};a.fn.bsgrid.defaults.extend.getCheckedRowsRecords=function(c){var b=[];a.each(a.fn.bsgrid.defaults.extend.getCheckedRowsIndexs(c),function(d,e){b[b.length]=a.fn.bsgrid.getRecord(e,c)});return b};a.fn.bsgrid.defaults.extend.activeGridEditMode=function(b){if(!b.settings.extend.settings.supportGridEdit){return}a("#"+b.gridId+" tbody tr:lt("+b.curPageRowsNum+") td .bsgrid_editgrid_hidden").each(function(){var c=a(this).removeClass("bsgrid_editgrid_hidden").clone(true);a(this).parent("td").html(c)})};a.fn.bsgrid.defaults.extend.getChangedRowsIndexs=function(b){var c=[];a("#"+b.gridId+" tbody tr").each(function(d){var e=a.trim(a(this).data("change"));if(!isNaN(e)&&parseInt(e)>0){c[c.length]=d}});return c};a.fn.bsgrid.defaults.extend.getChangedRowsOldRecords=function(c){var b=[];a.each(a.fn.bsgrid.defaults.extend.getChangedRowsIndexs(c),function(d,e){b[b.length]=a.fn.bsgrid.getRecord(e,c)});return b};a.fn.bsgrid.defaults.extend.getRowsChangedColumnsValue=function(c){var b={};a.each(a.fn.bsgrid.defaults.extend.getChangedRowsIndexs(c),function(d,e){b["row_"+e]={};a("#"+c.gridId+" tbody tr:eq("+e+") td").each(function(f){if(a(this).find(".bsgrid_editgrid_change").length>0){b["row_"+e][c.columnsModel[f].index]=a(this).find(".bsgrid_editgrid_change").val()}})});return b}})(jQuery); \ No newline at end of file +(function($){$.fn.bsgrid.defaults.extend.settings={supportGridEdit:false,supportGridEditTriggerEvent:"rowClick",supportColumnMove:false,searchConditionsContainerId:"",fixedGridHeader:false,fixedGridHeight:"320px"};$.extend(true,$.fn.bsgrid.defaults.colsProperties,{lineNumberAttr:"w_num",checkAttr:"w_check",editAttr:"w_edit",aggAttr:"w_agg"});$.fn.bsgrid.extendInitGrid={};$.fn.bsgrid.extendBeforeRenderGrid={};$.fn.bsgrid.extendRenderPerRow={};$.fn.bsgrid.extendRenderPerColumn={};$.fn.bsgrid.extendAfterRenderGrid={};$.fn.bsgrid.extendOtherMethods={};$.fn.bsgrid.extendInitGrid.initGridExtendOptions=function(gridId,options){var columnsModel=options.columnsModel;var colsProperties=options.settings.colsProperties;$.fn.bsgrid.getGridHeaderObject(options).each(function(i){columnsModel[i].lineNumber=$.trim($(this).attr(colsProperties.lineNumberAttr));columnsModel[i].check=$.trim($(this).attr(colsProperties.checkAttr));columnsModel[i].edit=$.trim($(this).attr(colsProperties.editAttr))});if($("#"+options.gridId+" tfoot tr td["+colsProperties.aggAttr+"!='']").length!=0){$("#"+options.gridId+" tfoot tr td").each(function(i){columnsModel[i].aggName="";columnsModel[i].aggIndex="";var aggInfo=$.trim($(this).attr(colsProperties.aggAttr));if(aggInfo.length!=0){var aggInfoArray=aggInfo.split(",");columnsModel[i].aggName=aggInfoArray[0].toLocaleLowerCase();columnsModel[i].aggIndex=aggInfoArray.length>1?aggInfoArray[1]:""}})}if($("#"+options.gridId+" thead tr:last th["+colsProperties.lineNumberAttr+"$='line']").length!=0){options.settings.extend.afterRenderGridMethods.renderLineNumber=$.fn.bsgrid.extendAfterRenderGrid.renderLineNumber}if($("#"+options.gridId+" thead tr:last th["+colsProperties.checkAttr+"='true']").length!=0){options.settings.extend.initGridMethods.initGridCheck=$.fn.bsgrid.extendInitGrid.initGridCheck;options.settings.extend.renderPerColumnMethods.renderCheck=$.fn.bsgrid.extendRenderPerColumn.renderCheck;options.settings.extend.afterRenderGridMethods.addCheckChangedEvent=$.fn.bsgrid.extendAfterRenderGrid.addCheckChangedEvent}if(options.settings.extend.settings.supportGridEdit){options.settings.extend.renderPerColumnMethods.renderForm=$.fn.bsgrid.extendRenderPerColumn.renderForm;options.settings.extend.afterRenderGridMethods.addGridEditEvent=$.fn.bsgrid.extendAfterRenderGrid.addGridEditEvent;var gridObj=$.fn.bsgrid.getGridObj(gridId);gridObj.activeGridEditMode=function(){return $.fn.bsgrid.defaults.extend.activeGridEditMode(options)};gridObj.getChangedRowsIndexs=function(){return $.fn.bsgrid.defaults.extend.getChangedRowsIndexs(options)};gridObj.getChangedRowsOldRecords=function(){return $.fn.bsgrid.defaults.extend.getChangedRowsOldRecords(options)};gridObj.getRowsChangedColumnsValue=function(){return $.fn.bsgrid.defaults.extend.getRowsChangedColumnsValue(options)}}if(options.settings.extend.settings.supportColumnMove){options.settings.extend.initGridMethods.initColumnMove=$.fn.bsgrid.extendInitGrid.initColumnMove}if(options.settings.extend.settings.fixedGridHeader){options.settings.extend.initGridMethods.initFixedHeader=$.fn.bsgrid.extendOtherMethods.initFixedHeader;options.settings.extend.afterRenderGridMethods.fixedHeader=function(parseSuccess,gridData,options){$.fn.bsgrid.extendOtherMethods.fixedHeader(false,options)}}if($.trim(options.settings.extend.settings.searchConditionsContainerId)!=""){options.settings.extend.initGridMethods.initSearchConditions=$.fn.bsgrid.extendInitGrid.initSearchConditions}if($("#"+options.gridId+" tfoot td["+colsProperties.aggAttr+"!='']").length!=0){options.settings.extend.afterRenderGridMethods.aggregation=$.fn.bsgrid.extendAfterRenderGrid.aggregation}};$.fn.bsgrid.extendInitGrid.initGridCheck=function(gridId,options){$.fn.bsgrid.getGridHeaderObject(options).each(function(hi){if(options.columnsModel[hi].check=="true"){if($.trim($(this).html())==""){$(this).html('')}$(this).find("input[type=checkbox]").change(function(){var checked=$.bsgrid.adaptAttrOrProp($(this),"checked")?true:false;$.bsgrid.adaptAttrOrProp($("#"+gridId+" tbody tr td:nth-child("+(hi+1)+")>input[type=checkbox]"),"checked",checked)})}});var gridObj=$.fn.bsgrid.getGridObj(gridId);gridObj.getCheckedRowsIndexs=function(){return $.fn.bsgrid.defaults.extend.getCheckedRowsIndexs(options)};gridObj.getCheckedRowsRecords=function(){return $.fn.bsgrid.defaults.extend.getCheckedRowsRecords(options)}};$.fn.bsgrid.extendInitGrid.initSearchConditions=function(gridId,options){var conditionsHtml=new StringBuilder();conditionsHtml.append('");conditionsHtml.append(" ");conditionsHtml.append('');$("#"+options.settings.extend.settings.searchConditionsContainerId).html(conditionsHtml.toString());$("#"+options.settings.extend.settings.searchConditionsContainerId+" select.bsgrid_conditions_select").change(function(){$(this).next("input.bsgrid_conditions_input").attr("name",$(this).val())}).trigger("change")};$.fn.bsgrid.extendInitGrid.initColumnMove=function(gridId,options){if($("#"+options.gridId+" thead tr").length!=1){return}$("#"+options.gridId).css({"table-layout":"fixed"});var headObj=$.fn.bsgrid.getGridHeaderObject(options);var headLen=headObj.length;headObj.each(function(i){var obj=this;$(obj).bind("selectstart",function(){return false});$(obj).css("-moz-user-select","none");$(obj).mousedown(function(){bindDownData(obj,i,headLen)});$(obj).mousemove(function(e){e=e||event;var left=$(obj).offset().left;var nObj=0,nLeft=0;if(i!=headLen-1){nObj=$(obj).next();nLeft=nObj.offset().left}var mObj=obj;if(i!=headLen-1&&e.clientX-nLeft>-10){mObj=nObj}if((i!=0&&e.clientX-left<10)||(i!=headLen-1&&e.clientX-nLeft>-10)){$(obj).css({cursor:"e-resize"});if($.trim($(obj).data("ex_mousedown"))!="mousedown"){return}var mWidth=$(mObj).width();var newMWidth=mWidth-e.clientX+$(mObj).offset().left;var preMWidth=$(mObj).prev().width();var preNewMWidth=preMWidth+e.clientX-$(mObj).offset().left;if(parseInt(newMWidth)>19&&parseInt(preNewMWidth)>19){$(mObj).width(newMWidth).prev().width(preNewMWidth)}}else{$(mObj).css({cursor:"default"});releaseDownData(obj,i,headLen)}});$(obj).mouseup(function(){releaseDownData(obj,i,headLen)});$(obj).mouseout(function(e){e=e||event;var objOffect=$(obj).offset();if(objOffect.top>e.clientY||objOffect.top+$(obj).height()'}}return false};$.fn.bsgrid.extendRenderPerColumn.renderForm=function(record,rowIndex,colIndex,tdObj,trObj,options){if(rowIndex'}else{if(edit=="text"||edit=="hidden"||edit=="password"||edit=="radio"||edit=="button"){return value+''}else{if(edit=="textarea"){return value+'"}}}}return false};$.fn.bsgrid.extendAfterRenderGrid.renderLineNumber=function(parseSuccess,gridData,options){$.fn.bsgrid.getGridHeaderObject(options).each(function(i){var num=options.columnsModel[i].lineNumber;if(num=="line"||num=="total_line"){$("#"+options.gridId+" tbody tr:lt("+options.curPageRowsNum+") td:nth-child("+(i+1)+")").each(function(li){$(this).html((num=="line")?(li+1):(li+options.startRow))})}})};$.fn.bsgrid.extendAfterRenderGrid.addCheckChangedEvent=function(parseSuccess,gridData,options){$.fn.bsgrid.getGridHeaderObject(options).each(function(hi){if(options.columnsModel[hi].checkAttr=="true"){var checkboxObj=$(this).find("input[type=checkbox]");var checkboxObjs=$("#"+options.gridId+" tbody tr td:nth-child("+(hi+1)+")>input[type=checkbox]");checkboxObjs.change(function(){var checked=$.bsgrid.adaptAttrOrProp(checkboxObj,"checked")?true:false;if(!checked&&checkboxObjs.filter(":checked").length==checkboxObjs.length){$.bsgrid.adaptAttrOrProp(checkboxObj,"checked",true)}else{if(checked&&checkboxObjs.filter(":checked").length!=checkboxObjs.length){$.bsgrid.adaptAttrOrProp(checkboxObj,"checked",false)}}})}})};$.fn.bsgrid.extendAfterRenderGrid.addGridEditEvent=function(parseSuccess,gridData,options){$("#"+options.gridId+" tbody tr:lt("+options.curPageRowsNum+")").each(function(ri){var rowObj=this;var columnsModel=options.columnsModel;$(rowObj).find("td").each(function(ci){if(columnsModel[ci].edit!=""){$(this).find(".bsgrid_editgrid_checkbox, .bsgrid_editgrid_edit").change(function(){if($.trim($(this).val())!=$.fn.bsgrid.getGridObj(options.gridId).getColumnValue(ri,columnsModel[ci].index)){$(this).addClass("bsgrid_editgrid_change")}else{$(this).removeClass("bsgrid_editgrid_change")}$(rowObj).data("change",$(rowObj).find(".bsgrid_editgrid_change").length)})}});if(options.settings.extend.settings.supportGridEditTriggerEvent==""){$(this).find(".bsgrid_editgrid_hidden").each(function(){showCellEdit(this)})}else{if(options.settings.extend.settings.supportGridEditTriggerEvent=="rowClick"){$(this).click(function(){$(this).find(".bsgrid_editgrid_hidden").each(function(){showCellEdit(this)})})}else{if(options.settings.extend.settings.supportGridEditTriggerEvent=="rowDoubleClick"){$(this).dblclick(function(){$(this).find(".bsgrid_editgrid_hidden").each(function(){showCellEdit(this)})})}else{if(options.settings.extend.settings.supportGridEditTriggerEvent=="cellClick"){$(this).find(".bsgrid_editgrid_hidden").each(function(){var formObj=this;$(formObj).parent("td").click(function(){showCellEdit(formObj)})})}else{if(options.settings.extend.settings.supportGridEditTriggerEvent=="cellDoubleClick"){$(this).find(".bsgrid_editgrid_hidden").each(function(){var formObj=this;$(formObj).parent("td").dblclick(function(){showCellEdit(formObj)})})}}}}}});function showCellEdit(formObj){var cloneObj=$(formObj).removeClass("bsgrid_editgrid_hidden").clone(true);$(formObj).parent("td").html(cloneObj)}};$.fn.bsgrid.extendAfterRenderGrid.aggregation=function(parseSuccess,gridData,options){var gridObj=$.fn.bsgrid.getGridObj(options.gridId);var columnsModel=options.columnsModel;$("#"+options.gridId+" tfoot tr td["+options.settings.colsProperties.aggAttr+"!='']").each(function(i){if(columnsModel[i].aggName!=""){var aggName=columnsModel[i].aggName;var val=null;if(aggName=="count"){val=options.curPageRowsNum}else{if(aggName=="countnotnone"||aggName=="sum"||aggName=="avg"||aggName=="max"||aggName=="min"||aggName=="concat"){if(aggName=="countnotnone"){val=0}var valHtml=new StringBuilder();$("#"+options.gridId+" tbody tr:lt("+options.curPageRowsNum+")").each(function(ri){var rval=gridObj.getColumnValue(ri,columnsModel[i].aggIndex);if(rval==""){}else{if(aggName=="countnotnone"){val=(val==null?0:val)+1}else{if(aggName=="sum"||aggName=="avg"){if(!isNaN(rval)){val=(val==null?0:val)+parseFloat(rval)}}else{if(aggName=="max"||aggName=="min"){if(!isNaN(rval)&&(val==null||(aggName=="max"&&parseFloat(rval)>val)||(aggName=="min"&&parseFloat(rval)input:checked").length==1){rowIndexs[rowIndexs.length]=i}});return rowIndexs};$.fn.bsgrid.defaults.extend.getCheckedRowsRecords=function(options){var records=[];$.each($.fn.bsgrid.defaults.extend.getCheckedRowsIndexs(options),function(i,rowIndex){records[records.length]=$.fn.bsgrid.getRecord(rowIndex,options)});return records};$.fn.bsgrid.defaults.extend.activeGridEditMode=function(options){if(!options.settings.extend.settings.supportGridEdit){return}$("#"+options.gridId+" tbody tr:lt("+options.curPageRowsNum+") td .bsgrid_editgrid_hidden").each(function(){var cloneObj=$(this).removeClass("bsgrid_editgrid_hidden").clone(true);$(this).parent("td").html(cloneObj)})};$.fn.bsgrid.defaults.extend.getChangedRowsIndexs=function(options){var rowIndexs=[];$("#"+options.gridId+" tbody tr").each(function(i){var cellChangedNumStr=$.trim($(this).data("change"));if(!isNaN(cellChangedNumStr)&&parseInt(cellChangedNumStr)>0){rowIndexs[rowIndexs.length]=i}});return rowIndexs};$.fn.bsgrid.defaults.extend.getChangedRowsOldRecords=function(options){var records=[];$.each($.fn.bsgrid.defaults.extend.getChangedRowsIndexs(options),function(i,rowIndex){records[records.length]=$.fn.bsgrid.getRecord(rowIndex,options)});return records};$.fn.bsgrid.defaults.extend.getRowsChangedColumnsValue=function(options){var values={};$.each($.fn.bsgrid.defaults.extend.getChangedRowsIndexs(options),function(i,rowIndex){values["row_"+rowIndex]={};$("#"+options.gridId+" tbody tr:eq("+rowIndex+") td").each(function(ci){if($(this).find(".bsgrid_editgrid_change").length>0){values["row_"+rowIndex][options.columnsModel[ci].index]=$(this).find(".bsgrid_editgrid_change").val()}})});return values};$.fn.bsgrid.extendOtherMethods.fixedHeader=function(iFirst,options){if($.trim($("#"+options.gridId+"_fixedDiv").data("fixedGridLock"))=="lock"){return}$("#"+options.gridId+"_fixedDiv").data("fixedGridLock","lock");var headTrNum=$("#"+options.gridId+" thead tr").length;if(!iFirst){headTrNum=headTrNum/2;$("#"+options.gridId+" thead tr:lt("+headTrNum+")").remove()}var fixedGridHeight=getSize(options.settings.extend.settings.fixedGridHeight);if(fixedGridHeight<$("#"+options.gridId).height()){$("#"+options.gridId+"_fixedDiv").height(fixedGridHeight);$("#"+options.gridId).width($("#"+options.gridId+"_fixedDiv").width()-18);$("#"+options.gridId+"_fixedDiv").animate({scrollTop:"0px"},0)}else{$("#"+options.gridId+"_fixedDiv").height($("#"+options.gridId).height());$("#"+options.gridId).width($("#"+options.gridId+"_fixedDiv").width()-1)}$("#"+options.gridId+" thead tr:lt("+headTrNum+")").clone(true).prependTo("#"+options.gridId+" thead");$("#"+options.gridId+" thead tr:lt("+headTrNum+")").css({"z-index":10,position:"fixed"}).width($("#"+options.gridId+" thead tr:last").width());$("#"+options.gridId+" thead tr:lt("+headTrNum+")").each(function(i){var position=$("#"+options.gridId+" thead tr:eq("+(headTrNum+i)+")").position();$(this).css({top:position.top-getSize($(this).find("th").css("border-top-width")),left:position.left})});$("#"+options.gridId+" thead tr:gt("+(headTrNum-1)+")").each(function(ri){$(this).find("th").each(function(i){var thObj=$(this);$("#"+options.gridId+" thead tr:eq("+ri+") th:eq("+i+")").height(thObj.height()+((ri==headTrNum-1)?2:1)*getSize(thObj.css("border-top-width"))).width(thObj.width()+getSize(thObj.css("border-left-width")))})});$("#"+options.gridId+"_fixedDiv").data("fixedGridLock","");function getSize(sizeStr){sizeStr=$.trim(sizeStr).toLowerCase().replace("px","");var sizeNum=parseFloat(sizeStr);return isNaN(sizeNum)?0:sizeNum}};$.fn.bsgrid.extendOtherMethods.initFixedHeader=function(gridId,options){$("#"+gridId).wrap('
');$("#"+gridId+"_fixedDiv").data("fixedGridLock","");$("#"+gridId+"_fixedDiv").css({padding:0,"border-width":0,width:"98%","overflow-y":"auto","margin-bottom":"-1px"});$("#"+gridId).css({width:"auto"});$("#"+gridId+"_pt_outTab").css({"border-top-width":"1px"});$.fn.bsgrid.extendOtherMethods.fixedHeader(true,options);$(window).resize(function(){$.fn.bsgrid.extendOtherMethods.fixedHeader(false,options)})}})(jQuery); \ No newline at end of file diff --git a/builds/js/grid.min.js b/builds/js/grid.min.js index 16e93f8..93a54ea 100644 --- a/builds/js/grid.min.js +++ b/builds/js/grid.min.js @@ -3,4 +3,4 @@ * Copyright 2014 Apache v2 License * https://github.com/baishui2004/jquery.bsgrid */ -(function($){$.fn.bsgrid={defaults:{dataType:"json",localData:false,url:"",otherParames:false,autoLoad:true,pageAll:false,pageSize:20,pageSizeSelect:false,pageSizeForGrid:[5,10,20,25,50,100,200,500],pageIncorrectTurnAlert:true,multiSort:false,displayBlankRows:true,lineWrap:false,stripeRows:false,changeColorIfRowSelected:true,pagingLittleToolbar:false,pagingToolbarAlign:"right",pagingBtnClass:"pagingBtn",displayPagingToolbarOnlyMultiPages:false,isProcessLockScreen:true,longLengthAotoSubAndTip:true,colsProperties:{align:"center",maxLength:40,indexAttr:"w_index",sortAttr:"w_sort",alignAttr:"w_align",lengthAttr:"w_length",renderAttr:"w_render",hiddenAttr:"w_hidden",tipAttr:"w_tip"},requestParamsName:{pageSize:"pageSize",curPage:"curPage",sortName:"sortName",sortOrder:"sortOrder"},beforeSend:function(options,XMLHttpRequest){},complete:function(options,XMLHttpRequest,textStatus){},processUserdata:function(userdata,options){},extend:{initGridMethods:{},beforeRenderGridMethods:{},renderPerRowMethods:{},renderPerColumnMethods:{},afterRenderGridMethods:{}},additionalBeforeRenderGrid:function(parseSuccess,gridData,options){},additionalRenderPerRow:function(record,rowIndex,trObj,options){},additionalRenderPerColumn:function(record,rowIndex,colIndex,tdObj,trObj,options){},additionalAfterRenderGrid:function(parseSuccess,gridData,options){}},gridObjs:{},init:function(gridId,settings){if(!$("#"+gridId).hasClass("bsgrid")){$("#"+gridId).addClass("bsgrid")}var options={settings:$.extend(true,{},$.fn.bsgrid.defaults,settings),gridId:gridId,noPagingationId:gridId+"_no_pagination",pagingOutTabId:gridId+"_pt_outTab",pagingId:gridId+"_pt",sortName:"",sortOrder:"",otherParames:settings.otherParames,totalRows:0,totalPages:0,curPage:1,curPageRowsNum:0,startRow:0,endRow:0};if($("#"+gridId).find("thead").length==0){$("#"+gridId).prepend("");$("#"+gridId).find("tr:lt("+($("#"+gridId+" tr").length-$("#"+gridId+" tfoot tr").length)+")").appendTo($("#"+gridId+" thead"))}if($("#"+gridId).find("tbody").length==0){$("#"+gridId+" thead").after("")}if($("#"+gridId).find("tfoot").length==0){$("#"+gridId).append('')}options.columnsModel=$.fn.bsgrid.initColumnsModel(options);if(settings.pageSizeForGrid!=undefined){options.settings.pageSizeForGrid=settings.pageSizeForGrid}options.settings.dataType=options.settings.dataType.toLowerCase();if(options.settings.pageSizeSelect){if($.inArray(options.settings.pageSize,options.settings.pageSizeForGrid)==-1){options.settings.pageSizeForGrid.push(options.settings.pageSize)}options.settings.pageSizeForGrid.sort(function(a,b){return a-b})}var gridObj={options:options,getPageCondition:function(curPage){return $.fn.bsgrid.getPageCondition(curPage,options)},page:function(curPage){$.fn.bsgrid.page(curPage,options)},loadGridData:function(dataType,gridData){$.fn.bsgrid.loadGridData(dataType,gridData,options)},getSelectedRow:function(){return $.fn.bsgrid.getSelectedRow(options)},selectRow:function(row){return $.fn.bsgrid.selectRow(row,options)},unSelectRow:function(){return $.fn.bsgrid.unSelectRow(options)},getUserdata:function(){return $.fn.bsgrid.getUserdata(options)},getRowRecord:function(rowObj){return $.fn.bsgrid.getRowRecord(rowObj)},getRecord:function(row){return $.fn.bsgrid.getRecord(row,options)},getRecordIndexValue:function(record,index){return $.fn.bsgrid.getRecordIndexValue(record,index,options)},getColumnValue:function(row,index){return $.fn.bsgrid.getColumnValue(row,index,options)},sort:function(obj){$.fn.bsgrid.sort(obj,options)},getGridHeaderObject:function(){return $.fn.bsgrid.getGridHeaderObject(options)},getColumnAttr:function(colIndex,attrName){return $.fn.bsgrid.getColumnAttr(colIndex,attrName,options)},appendHeaderSort:function(){$.fn.bsgrid.appendHeaderSort(options)},setGridBlankBody:function(){$.fn.bsgrid.setGridBlankBody(options)},createPagingOutTab:function(){$.fn.bsgrid.createPagingOutTab(options)},clearGridBodyData:function(){$.fn.bsgrid.clearGridBodyData(options)},getCurPage:function(){return $.fn.bsgrid.getCurPage(options)},refreshPage:function(){$.fn.bsgrid.refreshPage(options)},firstPage:function(){$.fn.bsgrid.firstPage(options)},prevPage:function(){$.fn.bsgrid.prevPage(options)},nextPage:function(){$.fn.bsgrid.nextPage(options)},lastPage:function(){$.fn.bsgrid.lastPage(options)},gotoPage:function(goPage){$.fn.bsgrid.gotoPage(options,goPage)},initPaging:function(){return $.fn.bsgrid.initPaging(options)},setPagingValues:function(){$.fn.bsgrid.setPagingValues(options)}};$.fn.bsgrid.gridObjs[gridId]=gridObj;if(options.settings.pageAll||options.settings.pageSize<1){options.settings.pageAll=true;options.settings.pageSize=0}gridObj.appendHeaderSort();gridObj.createPagingOutTab();if(!options.settings.pageAll){gridObj.pagingObj=gridObj.initPaging()}if(options.settings.isProcessLockScreen){$.fn.bsgrid.addLockScreen(options)}for(var key in options.settings.extend.initGridMethods){options.settings.extend.initGridMethods[key](gridId,options)}if(options.settings.autoLoad){setTimeout(function(){gridObj.page(1)},10)}else{gridObj.setGridBlankBody()}return gridObj},initColumnsModel:function(options){var columnsModel=[];$.fn.bsgrid.getGridHeaderObject(options).each(function(){var columnModel={};columnModel.sortName="";columnModel.sortOrder="";var sortInfo=$.trim($(this).attr(options.settings.colsProperties.sortAttr));if(sortInfo.length!=0){var sortInfoArray=sortInfo.split(",");columnModel.sortName=$.trim(sortInfoArray[0]);columnModel.sortOrder=$.trim(sortInfoArray.length>1?sortInfoArray[1]:"")}columnModel.index=$.trim($(this).attr(options.settings.colsProperties.indexAttr));columnModel.render=$.trim($(this).attr(options.settings.colsProperties.renderAttr));columnModel.tip=$.trim($(this).attr(options.settings.colsProperties.tipAttr));var maxLen=$.trim($(this).attr(options.settings.colsProperties.lengthAttr));columnModel.maxLen=maxLen.length!=0?parseInt(maxLen):options.settings.colsProperties.maxLength;var align=$.trim($(this).attr(options.settings.colsProperties.alignAttr));columnModel.align=align==""?options.settings.colsProperties.align:align;columnModel.hidden=$.trim($(this).attr(options.settings.colsProperties.hiddenAttr));columnsModel.push(columnModel)});return columnsModel},getGridObj:function(gridId){var obj=$.fn.bsgrid.gridObjs[gridId];return obj?obj:null},buildData:{gridData:function(type,curPage,data){if(type=="json"){return $.fn.bsgrid.buildJsonData.gridData(curPage,data)}else{if(type=="xml"){return $.fn.bsgrid.buildXmlData.gridData(curPage,data)}}return false}},parseData:{success:function(type,gridData){if(type=="json"){return $.fn.bsgrid.parseJsonData.success(gridData)}else{if(type=="xml"){return $.fn.bsgrid.parseXmlData.success(gridData)}}return false},totalRows:function(type,gridData){if(type=="json"){return $.fn.bsgrid.parseJsonData.totalRows(gridData)}else{if(type=="xml"){return $.fn.bsgrid.parseXmlData.totalRows(gridData)}}return false},curPage:function(type,gridData){if(type=="json"){return $.fn.bsgrid.parseJsonData.curPage(gridData)}else{if(type=="xml"){return $.fn.bsgrid.parseXmlData.curPage(gridData)}}return false},data:function(type,gridData){if(type=="json"){return $.fn.bsgrid.parseJsonData.data(gridData)}else{if(type=="xml"){return $.fn.bsgrid.parseXmlData.data(gridData)}}return false},userdata:function(type,gridData){if(type=="json"){return $.fn.bsgrid.parseJsonData.userdata(gridData)}else{if(type=="xml"){return $.fn.bsgrid.parseXmlData.userdata(gridData)}}return false},getDataLen:function(type,gridData){if(type=="json"||type=="xml"){return $.fn.bsgrid.parseData.data(type,gridData).length}return 0},getRecord:function(type,data,row){if(type=="json"){return $.fn.bsgrid.parseJsonData.getRecord(data,row)}else{if(type=="xml"){return $.fn.bsgrid.parseXmlData.getRecord(data,row)}}return false},getColumnValue:function(type,record,index){if(type=="json"){return $.fn.bsgrid.parseJsonData.getColumnValue(record,index)}else{if(type=="xml"){return $.fn.bsgrid.parseXmlData.getColumnValue(record,index)}}return false}},buildJsonData:{gridData:function(curPage,data){return{success:true,totalRows:data.length,curPage:curPage,data:data}}},parseJsonData:{success:function(json){return json.success},totalRows:function(json){return json.totalRows},curPage:function(json){return json.curPage},data:function(json){return json.data},userdata:function(json){return json.userdata},getRecord:function(data,row){return data[row]},getColumnValue:function(record,index){return $.trim(record[index])}},buildXmlData:{gridData:function(curPage,data){return'true'+$(""+data+"").find("row").length+""+curPage+""+data+""}},parseXmlData:{success:function(xml){return $.trim($(xml).find("gridData success").text())=="true"},totalRows:function(xml){return parseInt($(xml).find("gridData totalRows").text())},curPage:function(xml){return parseInt($(xml).find("gridData curPage").text())},data:function(xml){return $(xml).find("gridData data row")},userdata:function(xml){return $(xml).find("gridData userdata")},getRecord:function(data,row){return data.eq(row)},getColumnValue:function(record,index){return $.trim(record.find(index).text())}},getPageCondition:function(curPage,options){var params=new StringBuilder();if(options.otherParames==false){}else{if((typeof options.otherParames).toLowerCase()=="string"||options.otherParames instanceof String){params.append("&"+options.otherParames)}else{if(options.otherParames instanceof Array){$.each(options.otherParames,function(i,objVal){params.append("&"+objVal.name+"="+objVal.value)})}else{for(var key in options.otherParames){params.append("&"+key+"="+options.otherParames[key])}}}}var condition=params.length==0?"":params.toString().substring(1);condition+=(condition.length==0?"":"&")+options.settings.requestParamsName.pageSize+"="+options.settings.pageSize+"&"+options.settings.requestParamsName.curPage+"="+curPage+"&"+options.settings.requestParamsName.sortName+"="+options.sortName+"&"+options.settings.requestParamsName.sortOrder+"="+options.sortOrder;return condition},page:function(curPage,options){if($.trim(curPage)==""||isNaN(curPage)){alert($.bsgridLanguage.needInteger);return}var dataType=options.settings.dataType;if(options.settings.localData!=false){if(dataType=="json"){$.fn.bsgrid.loadGridData(dataType,$.fn.bsgrid.buildData.gridData(dataType,curPage,options.settings.localData),options)}else{if(dataType=="xml"){$.fn.bsgrid.loadGridData(dataType,""+$.fn.bsgrid.buildData.gridData(dataType,curPage,options.settings.localData)+"",options)}}return}$.ajax({type:"post",url:options.settings.url,data:$.fn.bsgrid.getPageCondition(curPage,options),dataType:dataType,beforeSend:function(XMLHttpRequest){if(options.settings.isProcessLockScreen){$.fn.bsgrid.lockScreen(options)}options.settings.beforeSend(options,XMLHttpRequest)},complete:function(XMLHttpRequest,textStatus){options.settings.complete(options,XMLHttpRequest,textStatus);if(options.settings.isProcessLockScreen){$.fn.bsgrid.unlockScreen(options)}},success:function(gridData,textStatus){$.fn.bsgrid.loadGridData(dataType,gridData,options)},error:function(XMLHttpRequest,textStatus,errorThrown){alert($.bsgridLanguage.errorForSendOrRequestData)}})},loadGridData:function(dataType,gridData,options){var parseSuccess=$.fn.bsgrid.parseData.success(dataType,gridData);for(var key in options.settings.extend.beforeRenderGridMethods){options.settings.extend.beforeRenderGridMethods[key](parseSuccess,gridData,options)}options.settings.additionalBeforeRenderGrid(parseSuccess,gridData,options);if(parseSuccess){var userdata=$.fn.bsgrid.parseData.userdata(dataType,gridData);$.fn.bsgrid.storeUserdata(userdata,options);options.settings.processUserdata(userdata,options);var totalRows=parseInt($.fn.bsgrid.parseData.totalRows(dataType,gridData));var curPage=parseInt($.fn.bsgrid.parseData.curPage(dataType,gridData));curPage=Math.max(curPage,1);if(options.settings.pageAll){curPage=1;options.settings.pageSize=totalRows;$("#"+options.noPagingationId).html(totalRows)}var pageSize=options.settings.pageSize;var totalPages=parseInt(totalRows/pageSize);totalPages=parseInt((totalRows%pageSize==0)?totalPages:totalPages+1);var curPageRowsNum=$.fn.bsgrid.parseData.getDataLen(dataType,gridData);curPageRowsNum=curPageRowsNum>pageSize?pageSize:curPageRowsNum;curPageRowsNum=(curPage*pageSize   ';$(this).append(sortHtml).find(".sort").click(function(){$.fn.bsgrid.sort($(this).parent("th"),options)})}})},setGridBlankBody:function(options){$("#"+options.gridId+" tbody tr").remove();var header=$.fn.bsgrid.getGridHeaderObject(options);var rowSb="";if(options.settings.pageSize>0){var columnsModel=options.columnsModel;var trSb=new StringBuilder();trSb.append("");for(var hi=0;hi")}trSb.append("");rowSb=trSb.toString()}var rowsSb=new StringBuilder();var curPageRowsNum=options.settings.pageSize;if(!options.settings.displayBlankRows){curPageRowsNum=options.endRow-options.startRow+1;curPageRowsNum=options.endRow>0?curPageRowsNum:0}if(curPageRowsNum==0){rowsSb.append(''+$.bsgridLanguage.noDataToDisplay+"")}else{for(var pi=0;pi