[filter box] making filter order matches the dropdown (#1007)

fixes https://github.com/airbnb/caravel/issues/1005
This commit is contained in:
Maxime Beauchemin 2016-08-26 15:22:43 -07:00 committed by GitHub
parent 7eceb140be
commit f17cfcbfa2
1 changed files with 7 additions and 1 deletions

View File

@ -86,9 +86,15 @@ function filterBox(slice) {
// filter box should ignore the dashboard's filters
const url = slice.jsonEndpoint({ extraFilters: false });
$.getJSON(url, (payload) => {
const filtersChoices = {};
// Making sure the ordering of the fields matches the setting in the
// dropdown as it may have been shuffled while serialized to json
payload.form_data.groupby.forEach((f) => {
filtersChoices[f] = payload.data[f];
});
ReactDOM.render(
<FilterBox
filtersChoices={payload.data}
filtersChoices={filtersChoices}
onChange={slice.setFilter}
origSelectedValues={slice.getFilters() || {}}
/>,