vaeThink2/public/static/admin_static/lib/jquery.bsgrid/builds/js/grid.extend.min.js

6 lines
20 KiB
JavaScript
Raw Normal View History

2020-04-01 11:45:12 +08:00
/**
* jQuery.bsgrid v1.38 by @Baishui2004
* Copyright 2014 Apache v2 License
* https://github.com/baishui2004/jquery.bsgrid
*/
(function($){$.fn.bsgrid.defaults.extend.settings={supportGridEdit:false,supportGridEditTriggerEvent:"rowClick",supportColumnMove:false,searchConditionsContainerId:"",fixedGridHeader:false,fixedGridHeight:"320px",gridEditConfigs:{text:{build:function(edit,value,record,rowIndex,colIndex,tdObj,trObj,options){return value+'<input class="bsgrid_editgrid_edit" type="'+edit+'" value="'+value+'"/>'},val:function(formObj){return formObj.val()}},checkbox:{build:function(edit,value,record,rowIndex,colIndex,tdObj,trObj,options){return value+'<input class="bsgrid_editgrid_checkbox" type="'+edit+'" value="'+value+'"/>'},val:function(formObj){return formObj.val()}},textarea:{build:function(edit,value,record,rowIndex,colIndex,tdObj,trObj,options){return value+'<textarea class="bsgrid_editgrid_edit">'+value+"</textarea>"},val:function(formObj){return formObj.val()}}}};$.fn.bsgrid.defaults.extend.settings.gridEditConfigs.hidden=$.fn.bsgrid.defaults.extend.settings.gridEditConfigs.text;$.fn.bsgrid.defaults.extend.settings.gridEditConfigs.password=$.fn.bsgrid.defaults.extend.settings.gridEditConfigs.text;$.fn.bsgrid.defaults.extend.settings.gridEditConfigs.radio=$.fn.bsgrid.defaults.extend.settings.gridEditConfigs.text;$.fn.bsgrid.defaults.extend.settings.gridEditConfigs.button=$.fn.bsgrid.defaults.extend.settings.gridEditConfigs.text;$.extend(true,$.fn.bsgrid.defaults.colsProperties,{lineNumberAttr:"w_num",checkAttr:"w_check",editAttr:"w_edit",aggAttr:"w_agg"});$.fn.bsgrid.defaults.event.customCellEditEvents={};$.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($.fn.bsgrid.getGridHeaderObject(options).filter("["+colsProperties.lineNumberAttr+"$='line']").length!=0){options.settings.extend.afterRenderGridMethods.renderLineNumber=$.fn.bsgrid.extendAfterRenderGrid.renderLineNumber}if($.fn.bsgrid.getGridHeaderObject(options).filter("["+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;options.settings.extend.afterRenderGridMethods.setOptionsFirstRowClone=$.fn.bsgrid.extendAfterRenderGrid.setOptionsFirstRowClone;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.ext