diff options
author | Clement Ho <ClemMakesApps@gmail.com> | 2016-12-11 01:04:58 +0300 |
---|---|---|
committer | Clement Ho <ClemMakesApps@gmail.com> | 2017-01-10 01:01:15 +0300 |
commit | f67316a7cb19374812bfc61dc98ece3110538e1b (patch) | |
tree | a01e35178a7b0debc1928be0d13379542cf7136d /app | |
parent | 0791116f5f6a6f3622af6d1caa9ba9da1818275f (diff) |
Hide list if it is dynamic and there are no items to render
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/droplab/droplab_ajax_filter.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/app/assets/javascripts/droplab/droplab_ajax_filter.js b/app/assets/javascripts/droplab/droplab_ajax_filter.js index 8d024c4b6d7..bdd9b059bb3 100644 --- a/app/assets/javascripts/droplab/droplab_ajax_filter.js +++ b/app/assets/javascripts/droplab/droplab_ajax_filter.js @@ -82,12 +82,16 @@ require('../window')(function(w){ } if (!self.destroyed) { - if (data[0].length === 0) { + var hookListChildren = self.hook.list.list.children; + var onlyDynamicList = hookListChildren.length === 1 && hookListChildren[0].hasAttribute('data-dynamic'); + + if (onlyDynamicList && data[0].length === 0) { self.hook.list.hide(); - } else { + } else if (onlyDynamicList && data[0].length !== 0) { self.hook.list.show(); - self.hook.list.setData.call(self.hook.list, data[0]); } + + self.hook.list.setData.call(self.hook.list, data[0]); } self.notLoading(); }); |