TimeTrex/interface/html5/dist/common-BaseTreeViewController.bundle.js

1 line
42 KiB
JavaScript
Raw Permalink Normal View History

2022-12-13 07:10:06 +01:00
"use strict";(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["common-BaseTreeViewController"],{1838:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"BaseTreeViewController\": () => (/* binding */ BaseTreeViewController)\n/* harmony export */ });\n/* provided dependency */ var $ = __webpack_require__(9755);\nclass BaseTreeViewController extends BaseViewController {\n\tsetSelectLayout( column_start_from ) {\n\t\tvar $this = this;\n\n\t\tvar grid;\n\t\tif ( !Global.isSet( this.grid ) ) {\n\t\t\tgrid = $( this.el ).find( '#grid' );\n\n\t\t\tgrid.attr( 'id', this.ui_id + '_grid' ); //Grid's id is ScriptName + _grid\n\n\t\t\tgrid = $( this.el ).find( '#' + this.ui_id + '_grid' );\n\t\t}\n\n\t\tvar column_info_array = [];\n\n\t\tif ( !this.select_layout ) { //Set to defalt layout if no layout at all\n\t\t\tthis.select_layout = { id: '' };\n\t\t\tthis.select_layout.data = { filter_data: {}, filter_sort: {} };\n\t\t\tthis.select_layout.data.display_columns = this.default_display_columns;\n\t\t}\n\t\tvar layout_data = this.select_layout.data;\n\n\t\tif ( layout_data.display_columns.length < 1 ) {\n\t\t\tlayout_data.display_columns = this.default_display_columns;\n\t\t}\n\n\t\tvar display_columns = this.buildDisplayColumns( layout_data.display_columns );\n\t\t//Set Data Grid on List view\n\t\tvar len = display_columns.length;\n\n\t\tvar start_from = 0;\n\n\t\tif ( Global.isSet( column_start_from ) && column_start_from > 0 ) {\n\t\t\tstart_from = column_start_from;\n\t\t}\n\n\t\tvar view_column_data = display_columns[0];\n\n\t\tvar column_info = {\n\t\t\tname: view_column_data.value,\n\t\t\tindex: view_column_data.value,\n\t\t\tlabel: $this.grid_table_name,\n\t\t\twidth: 100,\n\t\t\tsortable: false,\n\t\t\ttitle: false\n\t\t};\n\n\t\tcolumn_info_array.push( column_info );\n\n\t\tif ( this.grid ) {\n\t\t\tthis.grid.jqGrid( 'GridUnload' );\n\t\t\tthis.grid = null;\n\t\t}\n\n\t\tthis.grid = new TTGrid( this.ui_id + '_grid', {\n\t\t\tmultiselect: false,\n\t\t\twinMultiSelect: false,\n\t\t\ttree_mode: true,\n\t\t\tonSelectRow: $.proxy( this.onGridSelectRow, this )\n\t\t}, column_info_array );\n\n\t\tthis.bindGridColumnEvents();\n\n\t\tthis.setGridHeaderStyle(); //Set Sort Style\n\n\t\tthis.filter_data = this.select_layout.data.filter_data;\n\n\t\tthis.showGridBorders();\n\n\t\t$this.setGridSize();\n\t}\n\n\tsearch( set_default_menu, page_action, page_number ) {\n\t\tvar $this = this;\n\n\t\tif ( !Global.isSet( set_default_menu ) ) {\n\t\t\tset_default_menu = true;\n\t\t}\n\n\t\tvar filter = {};\n\t\tfilter.filter_data = {};\n\t\tfilter.filter_sort = {};\n\t\tfilter.filter_columns = this.getFilterColumnsFromDisplayColumns();\n\t\tfilter.filter_items_per_page = 0; // Default to 0 to load user preference defined\n\n\t\tif ( this.sub_view_mode && this.parent_key ) {\n\t\t\tthis.select_layout.data.filter_data[this.parent_key] = this.parent_value;\n\n\t\t\t//If sub view controller set custom filters, get it\n\t\t\tif ( Global.isSet( this.getSubViewFilter ) ) {\n\n\t\t\t\tthis.select_layout.data.filter_data = this.getSubViewFilter( this.select_layout.data.filter_data );\n\n\t\t\t}\n\t\t}\n\n\t\tthis.last_select_ids = this.getGridSelectIdArray();\n\t\t//select_layout will not be null, it's set in setSelectLayout function\n\t\tfilter.filter_data = Global.convertLayoutFilterToAPIFilter( this.select_layout );\n\t\tfilter.filter_sort = this.select_layout.data.filter_sort;\n\n\t\tthis.api['get' + this.api.key_name]( filter, false, false, {\n\t\t\tonResult: function( result ) {\n\n\t\t\t\tvar result_data = result.getResult();\n\n\t\t\t\tresult_data = Global.buildTreeRecord( result_data );\n\n\t\t\t\t$this.grid_current_page_items = result_data; // For tree mode only\n\n\t\t\t\tif ( !Global.isArray( result_data ) ) {\n\t\t\t\t\t$this.showNoResultCover();\n\t\t\t\t} else {\n\t\t\t\t\t$this.removeNoResultCover();\n\t\t\t\t}\n\n\t\t\t\t$this.reSetGridTreeData( result_data );\n\n