Feature #3232
Implement Ctrl-A 'Select All' on DVR Grids
0%
Description
... so you can select a batch of failed recordings in one go, for example, versus click-shiftclick. It just seems... right to have it, especially if you're disabling recordings so they fail gracefully instead of re-scheduling.
I have to show my utter ignorance of JavaScript and extJS here... I've looked at the code, and it should 'just' be a case of putting something like this in:
keys: { key: 'a', ctrl: true, stopEvent: true, handler: function() { <whateverthiselementis>.getSelectionModel().selectAll(); } }
... but this doesn't trigger if you define it at the panel level (e.g. where you define the Upcoming Recordings in dvr.js:
tvheadend.idnode_grid(panel, { url: 'api/dvr/entry', gridURL: 'api/dvr/entry/grid_upcoming', titleS: _('Upcoming Recording'), titleP: _('Upcoming / Current Recordings'), keys: { key: 'a', ctrl: true, handler: function() { console.log("##Ctrl-A pressed"); //debugging only - doesn't trigger here (wrong scope?) ....
It only triggers if you put it into the function that creates the panel, e.g. in dvr.js
tvheadend.dvr = function(panel, index) { var p = new Ext.TabPanel({ activeTab: 0, autoScroll: true, title: _('Digital Video Recorder'), iconCls: 'dvr', keys: { key: 'a', ctrl: true, handler: function() { console.log("##Ctrl-A pressed"); //debugging only - triggers here ...
... however, at that point I can't find the element ID for the relevant grid so nothing happens.
Sorry, a really half-baked thought, I know!
History
Updated by Jaroslav Kysela about 9 years ago
If Ext.grid.GridPanel handles also keys, you must propagate this variable at idnode.js:1601 . Note that we use "dynamic builders" now - so don't declare any variables outside the scope.
diff --git a/src/webui/static/app/idnode.js b/src/webui/static/app/idnode.js index 4e3494d..5028468 100644 --- a/src/webui/static/app/idnode.js +++ b/src/webui/static/app/idnode.js @@ -1610,7 +1610,8 @@ tvheadend.idnode_grid = function(panel, conf) forceFit: true }, tbar: buttons, - bbar: page + bbar: page, + keys: conf.keys }; grid = conf.readonly ? new Ext.grid.GridPanel(gconf) : new Ext.grid.EditorGridPanel(gconf);
Updated by Prof Yaffle about 9 years ago
So, would this be okay? It appears that the key definition is passed straight to tvheadend.idnode_grid in gconf from idnode.js:1601 ... (humour me, scope/this/etc. is all new ...):
var gconf = { stateful: true, stateId: conf.gridURL || conf.url, stripeRows: true, store: store, cm: model, selModel: select, plugins: plugins, viewConfig: { forceFit: true }, tbar: buttons, // new code here keys: { key: 'a', ctrl: true, stopEvent: true, handler: function() { grid.getSelectionModel().selectAll(); } }, // bbar: page };
It seems to work from my testing, but I don't know enough to know if I'm breaking something somewhere else!
Thanks. Sorry, didn't mean this to turn into a lesson
Updated by Prof Yaffle about 9 years ago
Of course - I just need to fix my branches, or you need to merge/cancel PR742 so my master branch is clean again. I'll look tomorrow how best to hammer git into shape.
(Yes, my fault for using master... yes, we all create work for you, I know... but yes, we're all grateful for the work )
Updated by Prof Yaffle about 9 years ago
Done - PR744, with previous commits moved to PR743. Boy, does git make my head bleed
Updated by Jaroslav Kysela about 9 years ago
While we're in the keys support - what about to add (Page) Up/Down / 'e' - edit etc. ?
Updated by Prof Yaffle about 9 years ago
I was just looking at that - insert Add entry, delete Delete entry, etc.
Let me look... it might depend on how the events are defined and whether they're consistent across grids (they should be, given the dynamic building)
Updated by Prof Yaffle about 9 years ago
@JK - not sure you saw my message on #hts - have a look at https://github.com/ProfYaffle/tvheadend/pull/1 when you get the chance, please.
Summary: it's not as trivial as I thought it might be, and it may be worth leaving this until some future extJS upgrade rather than hacking everything around for 4.2. YOu might look at what I've done and see where it's easily fixed, though, so I'll offer it anyway.
Updated by Jaroslav Kysela about 9 years ago
Yep - just working on different things. I have to study the extjs's key handling mechanism, too.