Ok, changing nextmatch row template via ajax should work now.

This commit is contained in:
Nathan Gray 2013-10-09 17:33:29 +00:00
parent da6d3d2d19
commit f12ab66b07

View File

@ -1203,7 +1203,7 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput],
{ {
// Keep the name of the template, as we'll free up the widget after parsing // Keep the name of the template, as we'll free up the widget after parsing
this.template = _value; this.template = _value;
template.loadingFinished();
// Fetch the grid element and parse it // Fetch the grid element and parse it
var definitionGrid = template.getChildren()[0]; var definitionGrid = template.getChildren()[0];
if (definitionGrid && definitionGrid instanceof et2_grid) if (definitionGrid && definitionGrid instanceof et2_grid)
@ -1238,24 +1238,14 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput],
// Start auto-refresh // Start auto-refresh
this._set_autorefresh(this._get_autorefresh()); this._set_autorefresh(this._get_autorefresh());
}; };
if(template.getChildren().length == 0)
{ // Template might not be loaded yet, defer parsing
// Template might not be loaded yet, defer parsing $j(template.getDOMNode()).on("load",
$j(template.getDOMNode()).on("load", jQuery.proxy(function() {
jQuery.proxy(function() { parse.call(this, template);
parse.call(this, template); this.resize();
this.resize(); }, this)
}, this) );
);
}
else
{
if(this.isAttached())
{
template.loadingFinished();
}
parse.call(this, template)
}
}, },
// Some accessors to match conventions // Some accessors to match conventions
@ -1557,24 +1547,12 @@ var et2_nextmatch_header_bar = et2_DOMWidget.extend(et2_INextmatchHeader,
// Register the handler which will update the "totalCount" display // Register the handler which will update the "totalCount" display
// Left & Right headers // Left & Right headers
this.headers = [];
this.header_div = jQuery(document.createElement("div")).addClass("ui-helper-clearfix ui-helper-reset").prependTo(this.div); this.header_div = jQuery(document.createElement("div")).addClass("ui-helper-clearfix ui-helper-reset").prependTo(this.div);
if(this.nextmatch.options.header_left || this.nextmatch.options.header_right) this.headers = [{id:this.nextmatch.options.header_left}, {id:this.nextmatch.options.header_right}];
{
var headers = [this.nextmatch.options.header_left, this.nextmatch.options.header_right];
for(var i = 0; i < headers.length; i++) {
if(headers[i])
{
this._build_left_right(i==0?'left':'right',headers[i]);
}
}
}
this.filters = jQuery(document.createElement("div")).appendTo(this.div) this.filters = jQuery(document.createElement("div")).appendTo(this.div)
.addClass("filters"); .addClass("filters");
// Add category // Add category
if(!settings.no_cat) { if(!settings.no_cat) {
settings.cat_id_label = egw.lang("Category"); settings.cat_id_label = egw.lang("Category");
@ -1668,6 +1646,7 @@ var et2_nextmatch_header_bar = et2_DOMWidget.extend(et2_INextmatchHeader,
// Set activeFilters to current value // Set activeFilters to current value
this.nextmatch.activeFilters.searchletter = current_letter; this.nextmatch.activeFilters.searchletter = current_letter;
} }
this.loadingFinished();
}, },
@ -1685,7 +1664,10 @@ var et2_nextmatch_header_bar = et2_DOMWidget.extend(et2_INextmatchHeader,
var header = et2_createWidget("template", {"id": template_name}, this); var header = et2_createWidget("template", {"id": template_name}, this);
jQuery(header.getDOMNode()).addClass(left_or_right == "left" ? "et2_hbox_left":"et2_hbox_right").addClass("nm_header"); jQuery(header.getDOMNode()).addClass(left_or_right == "left" ? "et2_hbox_left":"et2_hbox_right").addClass("nm_header");
this.headers.push(header); this.headers.push(header);
$j(header.getDOMNode()).on("load", jQuery.proxy(function() {this._bindHeaderInput(header);},this)); $j(header.getDOMNode()).on("load", jQuery.proxy(function() {
header.loadingFinished();
this._bindHeaderInput(header);
},this));
}, },
/** /**