From c0d2afe9b5e2019f2a85674ca5b18128fc6ee29e Mon Sep 17 00:00:00 2001 From: Adam Sutton Date: Sun, 22 Sep 2013 14:31:16 +0100 Subject: [PATCH] webui: add support for hidemode in grids. Also tidied a few things up. --- src/webui/static/app/idnode.js | 43 +++++++++++++++++++++++++++++++++- src/webui/static/app/mpegts.js | 2 ++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/src/webui/static/app/idnode.js b/src/webui/static/app/idnode.js index 6c8a641c..03419826 100644 --- a/src/webui/static/app/idnode.js +++ b/src/webui/static/app/idnode.js @@ -775,6 +775,43 @@ tvheadend.idnode_grid = function(panel, conf) }); buttons.push(editBtn); + /* Hide Mode */ + if (conf.hidemode) { + var hidemode = new Ext.form.ComboBox({ + width : 100, + displayField : 'val', + valueField : 'key', + store : new Ext.data.ArrayStore({ + id : 0, + fields : [ 'key', 'val' ], + data : [ ['default', 'Parent disabled'], + ['all', 'All' ], + ['none', 'None' ] ], + }), + value : 'default', + mode : 'local', + forceSelection : false, + triggerAction : 'all', + listeners : { + select : function (s, r) { + store.baseParams.hidemode = r.id; + page.changePage(0); + store.reload(); + } + } + }); + buttons.push('-'); + buttons.push('Hide:'); + buttons.push(hidemode); + } + var page = new Ext.PagingToolbar({ + store : store, + pageSize : 50, + displayInfo : true, + displayMsg : conf.titleP + ' {0} - {1} of {2}', + width : 50, + }); + /* Extra buttons */ if (conf.tbar) { buttons.push('-') @@ -824,8 +861,8 @@ tvheadend.idnode_grid = function(panel, conf) select : function (s, r) { if (r != page.pageSize) { page.pageSize = r.id; - store.reload(); page.changePage(0); + store.reload(); // TODO: currently setting pageSize=-1 to disable paging confuses // the UI elements, and I don't know how to sort that! } @@ -856,6 +893,10 @@ tvheadend.idnode_grid = function(panel, conf) tbar : buttons, bbar : page }); + grid.on('filterupdate', function() { + page.changePage(0); + }); + if (conf.tabIndex != null) panel.insert(conf.tabIndex, grid); else diff --git a/src/webui/static/app/mpegts.js b/src/webui/static/app/mpegts.js index 1f7c1bae..00cf2059 100644 --- a/src/webui/static/app/mpegts.js +++ b/src/webui/static/app/mpegts.js @@ -58,6 +58,7 @@ tvheadend.muxes = function(panel) titleS : 'Mux', titleP : 'Muxes', tabIndex : 2, + hidemode : true, add : { titleS : 'Mux', select : { @@ -107,6 +108,7 @@ tvheadend.services = function(panel) titleS : 'Service', titleP : 'Services', tabIndex : 3, + hidemode : true, add : false, del : false, selected : selected,