diff --git a/static/js/pandora/ui/filter.js b/static/js/pandora/ui/filter.js index 03e62ee7..6bfb802a 100644 --- a/static/js/pandora/ui/filter.js +++ b/static/js/pandora/ui/filter.js @@ -21,7 +21,29 @@ pandora.ui.filter = function(list) { sortKeys: pandora.site.sortKeys, viewKeys: pandora.site.listViews }) - .css({padding: '16px'}); + .css({padding: '16px'}) + .bindEvent({ + change: function(data) { + if (list) { + pandora.api.editList({ + id: list.id, + query: data.query + }, function(result) { + Ox.Request.clearCache(); // fixme: remove later + pandora.$ui.list + .bindEventOnce({ + init: function(data) { + Ox.print('NUMBER OF ITEMS:', data.items); + pandora.$ui.folderList[ + pandora.getListData().folder + ].value(list.id, 'items', data.items); + } + }) + .reloadList(); + }); + } + } + }); return that; }; diff --git a/static/js/pandora/ui/listDialog.js b/static/js/pandora/ui/listDialog.js index e42994e5..e556e834 100644 --- a/static/js/pandora/ui/listDialog.js +++ b/static/js/pandora/ui/listDialog.js @@ -17,7 +17,7 @@ pandora.ui.listDialog = function(list, section) { } else if (id == 'icon') { return pandora.ui.listIconPanel(list); } else if (id == 'query') { - return pandora.$ui.filter = pandora.ui.filter(); + return pandora.$ui.filter = pandora.ui.filter(list); } }, tabs: tabs