Fix widget not allowed / DOM error in nextmatch-accountfilter

This commit is contained in:
Nathan Gray 2013-02-08 10:38:09 +00:00
parent 194dd78deb
commit aa07a243c1
3 changed files with 15 additions and 11 deletions

View File

@ -1386,7 +1386,7 @@ var et2_nextmatch_customfields = et2_customfields_list.extend(et2_INextmatchHead
{
widget = et2_createWidget("nextmatch-entryheader", {
id: cf_id,
application: field.type,
only_app: field.type,
blur: field.label
}, this);
}
@ -1660,7 +1660,7 @@ var et2_nextmatch_entryheader = et2_link_entry.extend(et2_INextmatchHeader, {
if(typeof this.nextmatch.activeFilters.col_filter == 'undefined')
this.nextmatch.activeFilters.col_filter = {};
if(selected && selected.item.value) {
if(event.data.options.application)
if(event.data.options.only_app)
{
// Only one application, just give the ID
this.nextmatch.activeFilters["col_filter"][this.id] = selected.item.value;

View File

@ -389,7 +389,6 @@ var et2_link_entry = et2_inputWidget.extend({
init: function() {
this._super.apply(this, arguments);
this.div = null;
this.search = null;
this.app_select = null;
this._oldValue = {id: null, app: this.options.only_app};
@ -536,7 +535,7 @@ var et2_link_entry = et2_inputWidget.extend({
},
getDOMNode: function() {
return this.div[0];
return this.div ? this.div[0] : null;
},
transformAttributes: function(_attrs) {

View File

@ -63,9 +63,6 @@ var et2_selectAccount = et2_selectbox.extend({
this._super.apply(this, arguments);
// Allow search 'inside' this widget
this.supportedWidgetClasses = [et2_link_entry];
// Holder for search jQuery nodes
this.search = null;
@ -98,6 +95,9 @@ var et2_selectAccount = et2_selectbox.extend({
}
else if (type == 'popup')
{
// Allow search 'inside' this widget
this.supportedWidgetClasses = [et2_link_entry];
this._create_search();
// Use empty label as blur
if(this.options.empty_label) this.search_widget.set_blur(this.options.empty_label);
@ -112,11 +112,12 @@ var et2_selectAccount = et2_selectbox.extend({
}
this.search_widget.search.change(this, function(event) {
var value = event.data.search_widget.getValue();
event.data.value = typeof value == 'object' ? value.id : value;
event.data.value = typeof value == 'object' && value ? value.id : value;
event.data.input.trigger("change");
});
}
this.setDOMNode(this.search_widget.getDOMNode());
var div = jQuery(document.createElement("div")).append(this.search_widget.getDOMNode());
this.setDOMNode(div[0]);
}
},
@ -145,12 +146,16 @@ var et2_selectAccount = et2_selectbox.extend({
}
else if (type == 'popup')
{
// Allow search 'inside' this widget
this.supportedWidgetClasses = [et2_link_entry];
/**
* Popup takes the dialog and embeds it in place of the selectbox
*/
var dialog = this._open_multi_search();
dialog.dialog("close");
this.setDOMNode(this.dialog[0]);
var div = jQuery(document.createElement("div")).append(this.dialog);
this.setDOMNode(div[0]);
var select_col = jQuery('#selection_col',dialog).children();
var selected = jQuery('#selected', select_col);
@ -290,7 +295,7 @@ var et2_selectAccount = et2_selectbox.extend({
var search = this.search = jQuery(document.createElement("div"));
var search_widget = this.search_widget = et2_createWidget('link-entry', {
'application': 'home-accounts',
'only_app': 'home-accounts',
'query': function(request, response) {
// Clear previous search results for multi-select
if(!request.options)