TimeTrex/interface/html5/dist/ttgrid-TTGrid.bundle.js

1 line
68 KiB
JavaScript
Raw Permalink Normal View History

2022-12-13 07:10:06 +01:00
(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["ttgrid-TTGrid"],{2185:(__unused_webpack_module,__unused_webpack_exports,__webpack_require__)=>{eval("/* provided dependency */ var $ = __webpack_require__(9755);\n/**\n * @author: joshr@timetrex.com\n * @description wrapper class for jqgrid in timetrex.\n * Requires free-jqgrid 4.15.4+ and jquery 3.3.1+\n *\n * @param setup\n * @constructor\n */\nTTGrid = function( table_id, setup, column_info_array ) {\n\tthis.getGridId = function() {\n\t\treturn this.ui_id;\n\t};\n\n\tthis.setTableIDElement = function() {\n\t\tthis.table_id_element = $( '#' + this.ui_id );\n\t\treturn true;\n\t};\n\n\tthis.getTableIDElement = function() {\n\t\treturn this.table_id_element;\n\t};\n\n\tif ( !table_id || !setup || !column_info_array ) {\n\t\tDebug.Text( 'ERROR: constructor requires all 3 arguments', 'TTGrid.js', 'TTGrid', 'constructor', 10 );\n\t\treturn;\n\t}\n\n\tthis.ui_id = table_id;\n\n\t// Issue #2891 - Forcing GridUnload can cause grids inside a AComboBox to disappear after repeated opening. Check for container_selector is to mitigate that.\n\tif ( !setup.container_selector ) {\n\t\t// We are unloading grids with the same ID if they exist to help prevent: Uncaught TypeError: Failed to execute 'replaceChild' on 'Node': parameter 2 is not of type 'Node'.\n\t\t// Looping through array in reverse to make sure no index issues after splicing.\n\t\tfor ( var i = LocalCacheData.resizeable_grids.length - 1; i >= 0; i-- ) {\n\t\t\tif ( LocalCacheData.resizeable_grids[i] != null && LocalCacheData.resizeable_grids[i].grid != null && LocalCacheData.resizeable_grids[i].ui_id == this.ui_id ) {\n\t\t\t\tLocalCacheData.resizeable_grids[i].grid.jqGrid( 'GridUnload' );\n\t\t\t\tLocalCacheData.resizeable_grids.splice( i, 1 );\n\t\t\t} else if ( LocalCacheData.resizeable_grids[i] == null || LocalCacheData.resizeable_grids[i].grid == null ) {\n\t\t\t\t// LocalCacheData.resizeable_grids array gets full of null values from resize event and we are making sure to clear it out.\n\t\t\t\tLocalCacheData.resizeable_grids.splice( i, 1 );\n\t\t\t}\n\t\t}\n\t}\n\n\tvar max_height = null;\n\n\tthis.setTableIDElement();\n\tvar table_div = this.getTableIDElement();\n\n\tthis.grid = null;\n\n\tif ( table_div[0] == false ) {\n\t\tDebug.Text( 'ERROR: table_id not found in DOM', 'TTGrid.js', 'TTGrid', 'constructor', 10 );\n\t\treturn;\n\t}\n\n\t//Default grid settings.\n\tvar default_setup = {\n\t\tcontainer_selector: 'body',\n\t\tsub_grid_mode: false,\n\t\taltRows: true,\n\t\tdata: [],\n\t\tdatatype: 'local',\n\t\t//quickEmpty: 'true', //Default is 'quickest', might fix JS Exception: Uncaught TypeError: Failed to execute 'replaceChild' on 'Node': parameter 2 is not of type 'Node', but causes this instead: TTGrid.js?v=11.6.1-20191108:99 Uncaught TypeError: Cannot read property 'cells' of undefined\n\t\tsortable: false,\n\t\theight: table_div.parents( '.view' ).height(),\n\t\twidth: table_div.parent().width(),\n\t\trowNum: 10000,\n\t\tcolNames: [],\n\t\tcolModel: column_info_array,\n\t\tmultiselect: true,\n\t\tmultiselectWidth: 22,\n\t\tmultiboxonly: true,\n\t\tviewrecords: true,\n\t\tautoencode: true,\n\t\tscrollOffset: 0,\n\t\tverticalResize: true, //when the grid resizes do we reisize it vertically? needed for timesheet and subgrid views.\n\t\tresizeGrid: true,\n\t\twinMultiSelect: true\n\t\t// resizeStop: function(width, index){\n\t\t// \t//$this.setGridColumnsWidth(width, index);\n\t\t// }\n\t};\n\n\tif ( setup.max_height === true ) {\n\t\tsetup.max_height = max_height;\n\t}\n\n\tif ( setup ) {\n\t\tsetup = $.extend( {}, default_setup, setup );\n\t} else {\n\t\tsetup = default_setup;\n\t}\n\n\tthis.setup = setup;\n\n\ttable_div.empty(); //should unbind all events bound to the grid.\n\tthis.grid = table_div.jqGrid( setup );\n\n\tLocalCacheData.resizeable_grids.push( this );\n\n\tif ( setup.winMultiSelect === true ) {\n\t\tthis.grid.winMultiSelect();\n\t}\n\n\t//turn off grid resize event (for schedule grids that need to be rebuilt on every resize)\n\tthis.noResize = function() {\n\t\tthis.setup.onResiz