| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638 |
- (function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('core-js/modules/es.array.concat.js'), require('core-js/modules/es.array.filter.js'), require('core-js/modules/es.array.find.js'), require('core-js/modules/es.array.includes.js'), require('core-js/modules/es.array.index-of.js'), require('core-js/modules/es.array.join.js'), require('core-js/modules/es.array.sort.js'), require('core-js/modules/es.object.keys.js'), require('core-js/modules/es.object.to-string.js'), require('core-js/modules/es.regexp.exec.js'), require('core-js/modules/es.regexp.to-string.js'), require('core-js/modules/es.string.match.js'), require('core-js/modules/es.string.replace.js'), require('core-js/modules/es.string.starts-with.js'), require('core-js/modules/es.string.trim.js'), require('core-js/modules/web.dom-collections.for-each.js'), require('jquery')) :
- typeof define === 'function' && define.amd ? define(['exports', 'core-js/modules/es.array.concat.js', 'core-js/modules/es.array.filter.js', 'core-js/modules/es.array.find.js', 'core-js/modules/es.array.includes.js', 'core-js/modules/es.array.index-of.js', 'core-js/modules/es.array.join.js', 'core-js/modules/es.array.sort.js', 'core-js/modules/es.object.keys.js', 'core-js/modules/es.object.to-string.js', 'core-js/modules/es.regexp.exec.js', 'core-js/modules/es.regexp.to-string.js', 'core-js/modules/es.string.match.js', 'core-js/modules/es.string.replace.js', 'core-js/modules/es.string.starts-with.js', 'core-js/modules/es.string.trim.js', 'core-js/modules/web.dom-collections.for-each.js', 'jquery'], factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.BootstrapTable = {}, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, global.jQuery));
- })(this, (function (exports, es_array_concat_js, es_array_filter_js, es_array_find_js, es_array_includes_js, es_array_indexOf_js, es_array_join_js, es_array_sort_js, es_object_keys_js, es_object_toString_js, es_regexp_exec_js, es_regexp_toString_js, es_string_match_js, es_string_replace_js, es_string_startsWith_js, es_string_trim_js, web_domCollections_forEach_js, $) { 'use strict';
- function _typeof(o) {
- "@babel/helpers - typeof";
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
- return typeof o;
- } : function (o) {
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
- }, _typeof(o);
- }
- /* eslint-disable no-use-before-define */
- var Utils = $.fn.bootstrapTable.utils;
- var searchControls = 'select, input:not([type="checkbox"]):not([type="radio"])';
- function getInputClass(that) {
- var isSelect = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- var formControlClass = isSelect ? that.constants.classes.select : that.constants.classes.input;
- return that.options.iconSize ? Utils.sprintf('%s %s-%s', formControlClass, formControlClass, that.options.iconSize) : formControlClass;
- }
- function getOptionsFromSelectControl(selectControl) {
- return selectControl[0].options;
- }
- function getControlContainer(that) {
- if (that.options.filterControlContainer) {
- return $("".concat(that.options.filterControlContainer));
- }
- if (that.options.height && that._initialized) {
- return that.$tableContainer.find('.fixed-table-header table thead');
- }
- return that.$header;
- }
- function isKeyAllowed(keyCode) {
- return $.inArray(keyCode, [37, 38, 39, 40]) > -1;
- }
- function getSearchControls(that) {
- return getControlContainer(that).find(searchControls);
- }
- function hideUnusedSelectOptions(selectControl, uniqueValues) {
- var options = getOptionsFromSelectControl(selectControl);
- for (var i = 0; i < options.length; i++) {
- if (options[i].value !== '') {
- if (!uniqueValues.hasOwnProperty(options[i].value)) {
- selectControl.find(Utils.sprintf('option[value=\'%s\']', options[i].value)).hide();
- } else {
- selectControl.find(Utils.sprintf('option[value=\'%s\']', options[i].value)).show();
- }
- }
- }
- }
- function existOptionInSelectControl(selectControl, value) {
- var options = getOptionsFromSelectControl(selectControl);
- for (var i = 0; i < options.length; i++) {
- if (options[i].value === Utils.unescapeHTML(value)) {
- // The value is not valid to add
- return true;
- }
- }
- // If we get here, the value is valid to add
- return false;
- }
- function addOptionToSelectControl(selectControl, _value, text, selected, shouldCompareText) {
- var value = _value === undefined || _value === null ? '' : _value.toString().trim();
- value = Utils.removeHTML(Utils.unescapeHTML(value));
- text = Utils.removeHTML(Utils.unescapeHTML(text));
- if (existOptionInSelectControl(selectControl, value)) {
- return;
- }
- var isSelected = shouldCompareText ? value === selected || text === selected : value === selected;
- var option = new Option(text, value, false, isSelected);
- selectControl.get(0).add(option);
- }
- function sortSelectControl(selectControl, orderBy, options) {
- var $selectControl = selectControl.get(0);
- if (orderBy === 'server') {
- return;
- }
- var tmpAry = new Array();
- for (var i = 0; i < $selectControl.options.length; i++) {
- tmpAry[i] = new Array();
- tmpAry[i][0] = $selectControl.options[i].text;
- tmpAry[i][1] = $selectControl.options[i].value;
- tmpAry[i][2] = $selectControl.options[i].selected;
- }
- tmpAry.sort(function (a, b) {
- return Utils.sort(a[0], b[0], orderBy === 'desc' ? -1 : 1, options);
- });
- while ($selectControl.options.length > 0) {
- $selectControl.options[0] = null;
- }
- for (var _i = 0; _i < tmpAry.length; _i++) {
- var op = new Option(tmpAry[_i][0], tmpAry[_i][1], false, tmpAry[_i][2]);
- $selectControl.add(op);
- }
- }
- function fixHeaderCSS(_ref) {
- var $tableHeader = _ref.$tableHeader;
- $tableHeader.css('height', $tableHeader.find('table').outerHeight(true));
- }
- function getElementClass($element) {
- return $element.attr('class').split(' ').filter(function (className) {
- return className.startsWith('bootstrap-table-filter-control-');
- });
- }
- function getCursorPosition(el) {
- if ($(el).is('input[type=search]')) {
- var pos = 0;
- if ('selectionStart' in el) {
- pos = el.selectionStart;
- } else if ('selection' in document) {
- el.focus();
- var Sel = document.selection.createRange();
- var SelLength = document.selection.createRange().text.length;
- Sel.moveStart('character', -el.value.length);
- pos = Sel.text.length - SelLength;
- }
- return pos;
- }
- return -1;
- }
- function cacheValues(that) {
- var searchControls = getSearchControls(that);
- that._valuesFilterControl = [];
- searchControls.each(function () {
- var $field = $(this);
- var fieldClass = escapeID(getElementClass($field));
- if (that.options.height && !that.options.filterControlContainer) {
- $field = that.$el.find(".fixed-table-header .".concat(fieldClass));
- } else if (that.options.filterControlContainer) {
- $field = $("".concat(that.options.filterControlContainer, " .").concat(fieldClass));
- } else {
- $field = that.$el.find(".".concat(fieldClass));
- }
- that._valuesFilterControl.push({
- field: $field.closest('[data-field]').data('field'),
- value: $field.val(),
- position: getCursorPosition($field.get(0)),
- hasFocus: $field.is(':focus')
- });
- });
- }
- function setCaretPosition(elem, caretPos) {
- try {
- if (elem) {
- if (elem.createTextRange) {
- var range = elem.createTextRange();
- range.move('character', caretPos);
- range.select();
- } else {
- elem.setSelectionRange(caretPos, caretPos);
- }
- }
- } catch (ex) {
- // ignored
- }
- }
- function setValues(that) {
- var field = null;
- var result = [];
- var searchControls = getSearchControls(that);
- if (that._valuesFilterControl.length > 0) {
- // Callback to apply after settings fields values
- var callbacks = [];
- searchControls.each(function (i, el) {
- var $this = $(el);
- field = $this.closest('[data-field]').data('field');
- result = that._valuesFilterControl.filter(function (valueObj) {
- return valueObj.field === field;
- });
- if (result.length > 0) {
- if (result[0].hasFocus || result[0].value) {
- var fieldToFocusCallback = function (element, cacheElementInfo) {
- // Closure here to capture the field information
- var closedCallback = function closedCallback() {
- if (cacheElementInfo.hasFocus) {
- element.focus();
- }
- if (Array.isArray(cacheElementInfo.value)) {
- var $element = $(element);
- $.each(cacheElementInfo.value, function (i, e) {
- $element.find(Utils.sprintf('option[value=\'%s\']', e)).prop('selected', true);
- });
- } else {
- element.value = cacheElementInfo.value;
- }
- setCaretPosition(element, cacheElementInfo.position);
- };
- return closedCallback;
- }($this.get(0), result[0]);
- callbacks.push(fieldToFocusCallback);
- }
- }
- });
- // Callback call.
- if (callbacks.length > 0) {
- callbacks.forEach(function (callback) {
- return callback();
- });
- }
- }
- }
- function collectBootstrapTableFilterCookies() {
- var cookies = [];
- var cookieRegex = /bs\.table\.(filterControl|searchText)/g;
- var foundCookies = document.cookie.match(cookieRegex);
- var foundLocalStorage = localStorage;
- if (foundCookies) {
- $.each(foundCookies, function (i, _cookie) {
- var cookie = _cookie;
- if (/./.test(cookie)) {
- cookie = cookie.split('.').pop();
- }
- if ($.inArray(cookie, cookies) === -1) {
- cookies.push(cookie);
- }
- });
- }
- if (!foundLocalStorage) {
- return cookies;
- }
- Object.keys(localStorage).forEach(function (cookie) {
- if (!cookieRegex.test(cookie)) {
- return;
- }
- cookie = cookie.split('.').pop();
- if (!cookies.includes(cookie)) {
- cookies.push(cookie);
- }
- });
- return cookies;
- }
- function escapeID(id) {
- // eslint-disable-next-line no-useless-escape
- return String(id).replace(/([:.\[\],])/g, '\\$1');
- }
- function isColumnSearchableViaSelect(_ref2) {
- var filterControl = _ref2.filterControl,
- searchable = _ref2.searchable;
- return filterControl && filterControl.toLowerCase() === 'select' && searchable;
- }
- function isFilterDataNotGiven(_ref3) {
- var filterData = _ref3.filterData;
- return filterData === undefined || filterData.toLowerCase() === 'column';
- }
- function hasSelectControlElement(selectControl) {
- return selectControl && selectControl.length > 0;
- }
- function initFilterSelectControls(that) {
- var data = that.options.data;
- $.each(that.header.fields, function (j, field) {
- var column = that.columns[that.fieldsColumnsIndex[field]];
- var selectControl = getControlContainer(that).find("select.bootstrap-table-filter-control-".concat(escapeID(column.field)));
- if (isColumnSearchableViaSelect(column) && isFilterDataNotGiven(column) && hasSelectControlElement(selectControl)) {
- if (!selectControl[0].multiple && selectControl.get(selectControl.length - 1).options.length === 0) {
- // Added the default option, must use a non-breaking space( ) to pass the W3C validator
- addOptionToSelectControl(selectControl, '', column.filterControlPlaceholder || ' ', column.filterDefault);
- }
- var uniqueValues = {};
- for (var i = 0; i < data.length; i++) {
- // Added a new value
- var fieldValue = Utils.getItemField(data[i], field, false);
- var formatter = that.options.editable && column.editable ? column._formatter : that.header.formatters[j];
- var formattedValue = Utils.calculateObjectValue(that.header, formatter, [fieldValue, data[i], i], fieldValue);
- if (fieldValue === undefined || fieldValue === null) {
- fieldValue = formattedValue;
- column._forceFormatter = true;
- }
- if (column.filterDataCollector) {
- formattedValue = Utils.calculateObjectValue(that.header, column.filterDataCollector, [fieldValue, data[i], formattedValue], formattedValue);
- }
- if (column.searchFormatter) {
- fieldValue = formattedValue;
- }
- uniqueValues[formattedValue] = fieldValue;
- if (_typeof(formattedValue) === 'object' && formattedValue !== null) {
- formattedValue.forEach(function (value) {
- addOptionToSelectControl(selectControl, value, value, column.filterDefault);
- });
- continue;
- }
- }
- // eslint-disable-next-line guard-for-in
- for (var key in uniqueValues) {
- addOptionToSelectControl(selectControl, uniqueValues[key], key, column.filterDefault);
- }
- if (that.options.sortSelectOptions) {
- sortSelectControl(selectControl, column.filterOrderBy, that.options);
- }
- }
- });
- }
- function getFilterDataMethod(objFilterDataMethod, searchTerm) {
- var keys = Object.keys(objFilterDataMethod);
- for (var i = 0; i < keys.length; i++) {
- if (keys[i] === searchTerm) {
- return objFilterDataMethod[searchTerm];
- }
- }
- return null;
- }
- function createControls(that, header) {
- var addedFilterControl = false;
- var html;
- $.each(that.columns, function (_, column) {
- html = [];
- if (!column.visible && !(that.options.filterControlContainer && $(".bootstrap-table-filter-control-".concat(escapeID(column.field))).length >= 1)) {
- return;
- }
- if (!column.filterControl && !that.options.filterControlContainer) {
- html.push('<div class="no-filter-control"></div>');
- } else if (that.options.filterControlContainer) {
- // Use a filter control container instead of th
- var $filterControls = $(".bootstrap-table-filter-control-".concat(escapeID(column.field)));
- $.each($filterControls, function (_, filterControl) {
- var $filterControl = $(filterControl);
- if (!$filterControl.is('[type=radio]')) {
- var placeholder = column.filterControlPlaceholder || '';
- $filterControl.attr('placeholder', placeholder).val(column.filterDefault);
- }
- $filterControl.attr('data-field', column.field);
- });
- addedFilterControl = true;
- } else {
- // Create the control based on the html defined in the filterTemplate array.
- var nameControl = column.filterControl.toLowerCase();
- html.push('<div class="filter-control">');
- addedFilterControl = true;
- if (column.searchable && that.options.filterTemplate[nameControl]) {
- html.push(that.options.filterTemplate[nameControl](that, column, column.filterControlPlaceholder ? column.filterControlPlaceholder : '', column.filterDefault));
- }
- }
- // Filtering by default when it is set.
- if (column.filterControl && '' !== column.filterDefault && 'undefined' !== typeof column.filterDefault) {
- if ($.isEmptyObject(that.filterColumnsPartial)) {
- that.filterColumnsPartial = {};
- }
- if (!(column.field in that.filterColumnsPartial)) {
- that.filterColumnsPartial[column.field] = column.filterDefault;
- }
- }
- $.each(header.find('th'), function (_, th) {
- var $th = $(th);
- if ($th.data('field') === column.field) {
- $th.find('.filter-control').remove();
- $th.find('.fht-cell').html(html.join(''));
- return false;
- }
- });
- if (column.filterData && column.filterData.toLowerCase() !== 'column') {
- var filterDataType = getFilterDataMethod(filterDataMethods, column.filterData.substring(0, column.filterData.indexOf(':')));
- var filterDataSource;
- var selectControl;
- if (filterDataType) {
- filterDataSource = column.filterData.substring(column.filterData.indexOf(':') + 1, column.filterData.length);
- selectControl = header.find(".bootstrap-table-filter-control-".concat(escapeID(column.field)));
- addOptionToSelectControl(selectControl, '', column.filterControlPlaceholder, column.filterDefault, true);
- filterDataType(that, filterDataSource, selectControl, that.options.filterOrderBy, column.filterDefault);
- } else {
- throw new SyntaxError('Error. You should use any of these allowed filter data methods: var, obj, json, url, func.' + ' Use like this: var: {key: "value"}');
- }
- }
- });
- if (addedFilterControl) {
- header.off('keyup', 'input').on('keyup', 'input', function (_ref4, obj) {
- var currentTarget = _ref4.currentTarget,
- keyCode = _ref4.keyCode;
- keyCode = obj ? obj.keyCode : keyCode;
- if (that.options.searchOnEnterKey && keyCode !== 13) {
- return;
- }
- if (isKeyAllowed(keyCode)) {
- return;
- }
- var $currentTarget = $(currentTarget);
- if ($currentTarget.is(':checkbox') || $currentTarget.is(':radio')) {
- return;
- }
- clearTimeout(currentTarget.timeoutId || 0);
- currentTarget.timeoutId = setTimeout(function () {
- that.onColumnSearch({
- currentTarget: currentTarget,
- keyCode: keyCode
- });
- }, that.options.searchTimeOut);
- });
- header.off('change', 'select', '.fc-multipleselect').on('change', 'select', '.fc-multipleselect', function (_ref5) {
- var currentTarget = _ref5.currentTarget,
- keyCode = _ref5.keyCode;
- var $selectControl = $(currentTarget);
- var value = $selectControl.val();
- if (Array.isArray(value)) {
- for (var i = 0; i < value.length; i++) {
- if (value[i] && value[i].length > 0 && value[i].trim()) {
- $selectControl.find("option[value=\"".concat(value[i], "\"]")).attr('selected', true);
- }
- }
- } else if (value && value.length > 0 && value.trim()) {
- $selectControl.find('option[selected]').removeAttr('selected');
- $selectControl.find("option[value=\"".concat(value, "\"]")).attr('selected', true);
- } else {
- $selectControl.find('option[selected]').removeAttr('selected');
- }
- clearTimeout(currentTarget.timeoutId || 0);
- currentTarget.timeoutId = setTimeout(function () {
- that.onColumnSearch({
- currentTarget: currentTarget,
- keyCode: keyCode
- });
- }, that.options.searchTimeOut);
- });
- header.off('mouseup', 'input:not([type=radio])').on('mouseup', 'input:not([type=radio])', function (_ref6) {
- var currentTarget = _ref6.currentTarget,
- keyCode = _ref6.keyCode;
- var $input = $(currentTarget);
- var oldValue = $input.val();
- if (oldValue === '') {
- return;
- }
- setTimeout(function () {
- var newValue = $input.val();
- if (newValue === '') {
- clearTimeout(currentTarget.timeoutId || 0);
- currentTarget.timeoutId = setTimeout(function () {
- that.onColumnSearch({
- currentTarget: currentTarget,
- keyCode: keyCode
- });
- }, that.options.searchTimeOut);
- }
- }, 1);
- });
- header.off('change', 'input[type=radio]').on('change', 'input[type=radio]', function (_ref7) {
- var currentTarget = _ref7.currentTarget,
- keyCode = _ref7.keyCode;
- clearTimeout(currentTarget.timeoutId || 0);
- currentTarget.timeoutId = setTimeout(function () {
- that.onColumnSearch({
- currentTarget: currentTarget,
- keyCode: keyCode
- });
- }, that.options.searchTimeOut);
- });
- // See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date
- if (header.find('.date-filter-control').length > 0) {
- $.each(that.columns, function (i, _ref8) {
- var filterDefault = _ref8.filterDefault,
- filterControl = _ref8.filterControl,
- field = _ref8.field,
- filterDatepickerOptions = _ref8.filterDatepickerOptions;
- if (filterControl !== undefined && filterControl.toLowerCase() === 'datepicker') {
- var $datepicker = header.find(".date-filter-control.bootstrap-table-filter-control-".concat(escapeID(field)));
- if (filterDefault) {
- $datepicker.value(filterDefault);
- }
- if (filterDatepickerOptions.min) {
- $datepicker.attr('min', filterDatepickerOptions.min);
- }
- if (filterDatepickerOptions.max) {
- $datepicker.attr('max', filterDatepickerOptions.max);
- }
- if (filterDatepickerOptions.step) {
- $datepicker.attr('step', filterDatepickerOptions.step);
- }
- if (filterDatepickerOptions.pattern) {
- $datepicker.attr('pattern', filterDatepickerOptions.pattern);
- }
- $datepicker.on('change', function (_ref9) {
- var currentTarget = _ref9.currentTarget;
- clearTimeout(currentTarget.timeoutId || 0);
- currentTarget.timeoutId = setTimeout(function () {
- that.onColumnSearch({
- currentTarget: currentTarget
- });
- }, that.options.searchTimeOut);
- });
- }
- });
- }
- if (that.options.sidePagination !== 'server') {
- that.triggerSearch();
- }
- if (!that.options.filterControlVisible) {
- header.find('.filter-control, .no-filter-control').hide();
- }
- } else {
- header.find('.filter-control, .no-filter-control').hide();
- }
- that.trigger('created-controls');
- }
- function getDirectionOfSelectOptions(_alignment) {
- var alignment = _alignment === undefined ? 'left' : _alignment.toLowerCase();
- switch (alignment) {
- case 'left':
- return 'ltr';
- case 'right':
- return 'rtl';
- case 'auto':
- return 'auto';
- default:
- return 'ltr';
- }
- }
- function syncHeaders(that) {
- if (!that.options.height) {
- return;
- }
- var fixedHeader = that.$tableContainer.find('.fixed-table-header table thead');
- if (fixedHeader.length === 0) {
- return;
- }
- that.$header.children().find('th[data-field]').each(function (_, element) {
- if (element.classList[0] !== 'bs-checkbox') {
- var $element = $(element);
- var $field = $element.data('field');
- var $fixedField = that.$tableContainer.find("th[data-field='".concat($field, "']")).not($element);
- var input = $element.find('input');
- var fixedInput = $fixedField.find('input');
- if (input.length > 0 && fixedInput.length > 0) {
- if (input.val() !== fixedInput.val()) {
- input.val(fixedInput.val());
- }
- }
- }
- });
- }
- var filterDataMethods = {
- func: function func(that, filterDataSource, selectControl, filterOrderBy, selected) {
- var variableValues = window[filterDataSource].apply();
- // eslint-disable-next-line guard-for-in
- for (var key in variableValues) {
- addOptionToSelectControl(selectControl, key, variableValues[key], selected);
- }
- if (that.options.sortSelectOptions) {
- sortSelectControl(selectControl, filterOrderBy, that.options);
- }
- setValues(that);
- },
- obj: function obj(that, filterDataSource, selectControl, filterOrderBy, selected) {
- var objectKeys = filterDataSource.split('.');
- var variableName = objectKeys.shift();
- var variableValues = window[variableName];
- if (objectKeys.length > 0) {
- objectKeys.forEach(function (key) {
- variableValues = variableValues[key];
- });
- }
- // eslint-disable-next-line guard-for-in
- for (var key in variableValues) {
- addOptionToSelectControl(selectControl, key, variableValues[key], selected);
- }
- if (that.options.sortSelectOptions) {
- sortSelectControl(selectControl, filterOrderBy, that.options);
- }
- setValues(that);
- },
- var: function _var(that, filterDataSource, selectControl, filterOrderBy, selected) {
- var variableValues = window[filterDataSource];
- var isArray = Array.isArray(variableValues);
- for (var key in variableValues) {
- if (isArray) {
- addOptionToSelectControl(selectControl, variableValues[key], variableValues[key], selected, true);
- } else {
- addOptionToSelectControl(selectControl, key, variableValues[key], selected, true);
- }
- }
- if (that.options.sortSelectOptions) {
- sortSelectControl(selectControl, filterOrderBy, that.options);
- }
- setValues(that);
- },
- url: function url(that, filterDataSource, selectControl, filterOrderBy, selected) {
- $.ajax({
- url: filterDataSource,
- dataType: 'json',
- success: function success(data) {
- // eslint-disable-next-line guard-for-in
- for (var key in data) {
- addOptionToSelectControl(selectControl, key, data[key], selected);
- }
- if (that.options.sortSelectOptions) {
- sortSelectControl(selectControl, filterOrderBy, that.options);
- }
- setValues(that);
- }
- });
- },
- json: function json(that, filterDataSource, selectControl, filterOrderBy, selected) {
- var variableValues = JSON.parse(filterDataSource);
- // eslint-disable-next-line guard-for-in
- for (var key in variableValues) {
- addOptionToSelectControl(selectControl, key, variableValues[key], selected);
- }
- if (that.options.sortSelectOptions) {
- sortSelectControl(selectControl, filterOrderBy, that.options);
- }
- setValues(that);
- }
- };
- exports.addOptionToSelectControl = addOptionToSelectControl;
- exports.cacheValues = cacheValues;
- exports.collectBootstrapTableFilterCookies = collectBootstrapTableFilterCookies;
- exports.createControls = createControls;
- exports.escapeID = escapeID;
- exports.existOptionInSelectControl = existOptionInSelectControl;
- exports.fixHeaderCSS = fixHeaderCSS;
- exports.getControlContainer = getControlContainer;
- exports.getCursorPosition = getCursorPosition;
- exports.getDirectionOfSelectOptions = getDirectionOfSelectOptions;
- exports.getElementClass = getElementClass;
- exports.getFilterDataMethod = getFilterDataMethod;
- exports.getInputClass = getInputClass;
- exports.getOptionsFromSelectControl = getOptionsFromSelectControl;
- exports.getSearchControls = getSearchControls;
- exports.hasSelectControlElement = hasSelectControlElement;
- exports.hideUnusedSelectOptions = hideUnusedSelectOptions;
- exports.initFilterSelectControls = initFilterSelectControls;
- exports.isColumnSearchableViaSelect = isColumnSearchableViaSelect;
- exports.isFilterDataNotGiven = isFilterDataNotGiven;
- exports.isKeyAllowed = isKeyAllowed;
- exports.setCaretPosition = setCaretPosition;
- exports.setValues = setValues;
- exports.sortSelectControl = sortSelectControl;
- exports.syncHeaders = syncHeaders;
- }));
|