WEBUI JS: Fix rendering of weekdays in autorec

This commit is contained in:
Jaroslav Kysela 2014-09-10 23:30:18 +02:00
parent 8323fa7839
commit 6ba1d6f035
2 changed files with 32 additions and 6 deletions

View file

@ -354,8 +354,36 @@ tvheadend.autorec_editor = function(panel, index) {
del: true,
list: 'enabled,title,channel,tag,content_type,minduration,' +
'maxduration,weekdays,start,pri,config_name,creator,comment',
columns: {
weekdays: {
renderer: function(st) {
return function(v) {
var t = [];
var d = v.push ? v : [v];
if (d.length == 7) {
v = "All days";
} else if (d.length == 0) {
v = "No days";
} else {
for (var i = 0; i < d.length; i++) {
var r = st.find('key', d[i]);
if (r !== -1) {
var nv = st.getAt(r).get('val');
if (nv)
t.push(nv);
} else {
t.push(d[i]);
}
}
v = t.join(',');
}
return v;
}
}
}
},
sort: {
field: 'name',
field: 'title',
direction: 'ASC'
},
help: function() {

View file

@ -134,7 +134,6 @@ tvheadend.IdNodeField = function(conf)
*/
this.onrefresh = function(callback) {
this.rcallback = callback;
var st = this.store;
if (st && st instanceof Ext.data.JsonStore)
st.on('load', callback);
@ -175,7 +174,7 @@ tvheadend.IdNodeField = function(conf)
dataIndex: this.id,
header: this.text,
editor: this.editor({create: false}),
renderer: cfg.renderer ? cfg.renderer() : this.renderer(),
renderer: cfg.renderer ? cfg.renderer(this.store) : this.renderer(this.store),
editable: !this.rdonly,
hidden: this.hidden,
filter: {
@ -194,7 +193,7 @@ tvheadend.IdNodeField = function(conf)
return props;
};
this.renderer = function()
this.renderer = function(st)
{
if (this.password)
return function(v) {
@ -224,10 +223,9 @@ tvheadend.IdNodeField = function(conf)
}
}
if (!this.store)
if (!st)
return null;
var st = this.store;
return function(v) {
if (st && st instanceof Ext.data.JsonStore) {
var t = [];