webui: add support for hidemode in grids. Also tidied a few things up.

This commit is contained in:
Adam Sutton 2013-09-22 14:31:16 +01:00
parent 9ecaf8f01c
commit c0d2afe9b5
2 changed files with 44 additions and 1 deletions

View file

@ -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

View file

@ -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,