}));
}
- var confcombo = new Ext.form.ComboBox({
+ var confcombo = new Ext.ux.form.ComboAny({
store: store,
triggerAction: 'all',
mode: 'local',
// Channels, uses global store
- var epgFilterChannels = new Ext.form.ComboBox({
+ var epgFilterChannels = new Ext.ux.form.ComboAny({
loadingText: _('Loading...'),
width: 200,
displayField: 'val',
// Tags, uses global store
- var epgFilterChannelTags = new Ext.form.ComboBox({
+ var epgFilterChannelTags = new Ext.ux.form.ComboAny({
loadingText: _('Loading...'),
width: 200,
displayField: 'val',
// Content groups
- var epgFilterContentGroup = new Ext.form.ComboBox({
+ var epgFilterContentGroup = new Ext.ux.form.ComboAny({
loadingText: _('Loading...'),
width: 200,
displayField: 'val',
}
});
- var epgFilterDuration = new Ext.form.ComboBox({
+ var epgFilterDuration = new Ext.ux.form.ComboAny({
loadingText: _('Loading...'),
width: 150,
displayField: 'label',
this.editor = function(conf)
{
var cons = null;
- var combo = false;
/* Editable? */
var d = this.rdonly;
c['fromLegend'] = _('Available');
} else {
- cons = Ext.form.ComboBox;
+ cons = Ext.ux.form.ComboAny;
if (this.list) {
cons = Ext.ux.form.LovCombo;
c['checkField'] = 'checked_' + this.id;
c['forceSelection'] = false;
c['triggerAction'] = 'all';
c['emptyText'] = _('Select {0} ...').replace('{0}', this.text);
-
- combo = true;
}
/* Single */
}
}
- var r = new cons(c);
- if (combo)
- r.doQuery = tvheadend.doQueryAnyMatch;
- return r;
+ return new cons(c);
};
};
/* Enumerated (combobox) type */
} else if (f['enum']) {
- var cons = Ext.form.ComboBox;
+ var cons = Ext.ux.form.ComboAny;
if (f.list)
cons = Ext.ux.form.LovCombo;
var st = tvheadend.idnode_enum_store(f);
}
});
- r.doQuery = tvheadend.doQueryAnyMatch;
-
if (st.on) {
var fn = function() {
st.un('load', fn);
return conf;
}
-/*
- * Any Match option in ComboBox queries
- * This query is identical as in extjs-all.js
- * except one
- */
-tvheadend.doQueryAnyMatch = function(q, forceAll) {
- q = Ext.isEmpty(q) ? '' : q;
- var qe = {
- query: q,
- forceAll: forceAll,
- combo: this,
- cancel:false
- };
-
- if (this.fireEvent('beforequery', qe) === false || qe.cancel)
- return false;
-
- q = qe.query;
- forceAll = qe.forceAll;
- if (forceAll === true || (q.length >= this.minChars)) {
- if (this.lastQuery !== q) {
- this.lastQuery = q;
- if (this.mode == 'local') {
- this.selectedIndex = -1;
- if (forceAll) {
- this.store.clearFilter();
- } else {
- /* supply the anyMatch option (last param) */
- this.store.filter(this.displayField, q, true);
- }
- this.onLoad();
- } else {
- this.store.baseParams[this.queryParam] = q;
- this.store.load({ params: this.getParams(q) });
- this.expand();
- }
- } else {
- this.selectedIndex = -1;
- this.onLoad();
- }
- }
-}
-
/*
* Replace one entry
*/
-
tvheadend.replace_entry = function(r, d) {
if (!r) return;
var dst = r.data;
initialChannelName = record.data.val;
}
- var selectChannel = new Ext.form.ComboBox({
+ var selectChannel = new Ext.ux.form.ComboAny({
loadingText: _('Loading...'),
width: 200,
displayField: 'val',
});
}
- var selectProfile = new Ext.form.ComboBox({
+ var selectProfile = new Ext.ux.form.ComboAny({
loadingText: _('Loading...'),
width: 150,
displayField: 'val',
// create namespace
Ext.ns('Ext.ux.form');
+
+/**
+ *
+ * @class Ext.ux.form.ComboAny
+ * @extends Ext.form.ComboBox
+ */
+Ext.ns('Ext.ux.form');
+Ext.ux.form.ComboAny = Ext.extend(Ext.form.ComboBox, {
+
+ doQuery: function(q, forceAll) {
+ q = Ext.isEmpty(q) ? '' : q;
+ var qe = {
+ query: q,
+ forceAll: forceAll,
+ combo: this,
+ cancel:false
+ };
+
+ if (this.fireEvent('beforequery', qe) === false || qe.cancel)
+ return false;
+
+ q = qe.query;
+ forceAll = qe.forceAll;
+ if (forceAll === true || (q.length >= this.minChars)) {
+ if (this.lastQuery !== q) {
+ this.lastQuery = q;
+ if (this.mode == 'local') {
+ this.selectedIndex = -1;
+ if (forceAll) {
+ this.store.clearFilter();
+ } else {
+ /* supply the anyMatch option (last param) */
+ this.store.filter(this.displayField, q, true);
+ }
+ this.onLoad();
+ } else {
+ this.store.baseParams[this.queryParam] = q;
+ this.store.load({ params: this.getParams(q) });
+ this.expand();
+ }
+ } else {
+ this.selectedIndex = -1;
+ this.onLoad();
+ }
+ }
+ },
+
+ onTypeAhead: function() {
+ if (this.store.getCount() > 0) {
+ var r = this.store.getAt(0);
+ var newValue = r.data[this.displayField];
+ var len = newValue.length;
+ var olen = this.getRawValue().length;
+ if (olen != len) {
+ this.setRawValue(newValue);
+ this.selectText(0, len);
+ }
+ }
+ }
+
+});
+
/**
*
* @class Ext.ux.form.LovCombo
* @extends Ext.form.ComboBox
*/
-Ext.ux.form.LovCombo = Ext.extend(Ext.form.ComboBox, {
+Ext.ux.form.LovCombo = Ext.extend(Ext.ux.form.ComboAny, {
// {{{
// configuration options