diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-01-09 19:59:54 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-01-09 19:59:54 +0000 |
commit | fd3c08aaa107e2c5a412a06aea6890b147e46aaf (patch) | |
tree | 6e55b3f482eddc77ff7cc7f593aa0754e9494a0b /public | |
parent | 72f59192525bd6dc3af2cfa00d5b184892335c8d (diff) | |
download | redmine-fd3c08aaa107e2c5a412a06aea6890b147e46aaf.tar.gz redmine-fd3c08aaa107e2c5a412a06aea6890b147e46aaf.zip |
Don't preload all query filters (#24787).
git-svn-id: http://svn.redmine.org/redmine/trunk@16170 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'public')
-rw-r--r-- | public/javascripts/application.js | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/public/javascripts/application.js b/public/javascripts/application.js index f38b69b3c..098d9d3b2 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -120,6 +120,18 @@ function initFilters() { function addFilter(field, operator, values) { var fieldId = field.replace('.', '_'); var tr = $('#tr_'+fieldId); + + var filterOptions = availableFilters[field]; + if (!filterOptions) return; + + if (filterOptions['remote'] && filterOptions['values'] == null) { + $.getJSON(filtersUrl, {'name': field}).done(function(data) { + filterOptions['values'] = data; + addFilter(field, operator, values) ; + }); + return; + } + if (tr.length > 0) { tr.show(); } else { @@ -134,7 +146,7 @@ function addFilter(field, operator, values) { }); } -function buildFilterRow(field, operator, values) { +function buildFilterRow(field, operator, values, loadedValues) { var fieldId = field.replace('.', '_'); var filterTable = $("#filters-table"); var filterOptions = availableFilters[field]; @@ -212,8 +224,8 @@ function buildFilterRow(field, operator, values) { ); $('#values_'+fieldId).val(values[0]); select = tr.find('td.values select'); - for (i = 0; i < allProjects.length; i++) { - var filterValue = allProjects[i]; + for (i = 0; i < filterValues.length; i++) { + var filterValue = filterValues[i]; var option = $('<option>'); option.val(filterValue[1]).text(filterValue[0]); if (values[0] == filterValue[1]) { option.attr('selected', true); } |