A free open source IT asset/license management system
Added JS to handle data-dash attribute overrides
snipe4d6279d61c25
diff --git a/resources/views/partials/bootstrap-table.blade.php b/resources/views/partials/bootstrap-table.blade.phpindex 482724894d..f52ce032d0 100644--- a/resources/views/partials/bootstrap-table.blade.php+++ b/resources/views/partials/bootstrap-table.blade.php@@ -48,6 +48,19 @@}return htmlData}++ // This allows us to override the table defaults set below using the data-dash attributes+ var table = this;+ var data_with_default = function (key,default_value) {+ console.dir($(table).data());+ attrib_val = $(table).data(key);+ if(attrib_val !== undefined) {+ return attrib_val;+ }+ return default_value;+ }++$(this).bootstrapTable({ajaxOptions: {@@ -65,23 +78,23 @@cookieStorage: '{{ config('session.bs_table_storage') }}',cookie: true,cookieExpire: '2y',- search: true,- advancedSearch: true,- searchHighlight: true,- clickToSelect: true,- showPrint: true,- showFullscreen: true,- showColumns: true,- showExport: true,- showColumnsToggleAll: true,- showRefresh: true,- pagination: true,- sortOrder: 'asc',- minimumCountColumns: 2,- mobileResponsive: true,- maintainSelected: true,+ search: data_with_default('search', true),+ advancedSearch: data_with_default('advanced-search', true),+ searchHighlight: data_with_default('search-highlight', true),+ clickToSelect: data_with_default('click-to-select', true),+ showPrint: data_with_default('show-print', true),+ showFullscreen: data_with_default('show-fullscreen', true),+ showColumns: data_with_default('show-columns', true),+ showExport: data_with_default('show-export', true),+ showColumnsToggleAll: data_with_default('show-columns-toggle-all', true),+ showRefresh: data_with_default('show-refresh', true),+ pagination: data_with_default('pagination', true),+ sortOrder: data_with_default('sort-order', 'asc'),+ minimumCountColumns: data_with_default('minimum-count-columns', 2),+ mobileResponsive: data_with_default('mobile-responsive', true),+ maintainSelected: data_with_default('maintain-selected', true),trimOnSearch: false,- showSearchClearButton: true,+ showSearchClearButton: data_with_default('show-search-clear-button', true),addrbar: {{ (config('session.bs_table_addrbar') == 'true') ? 'true' : 'false'}}, // deeplink search phrases, sorting, etcpaginationFirstText: "{{ trans('general.first') }}",paginationLastText: "{{ trans('general.last') }}",