Choleriker
02-11-2007, 03:31 AM
Hey,
i short hint: i have seen that the version 1.0 of yui-ext has a nice extension to preset the default for all update-managers like this:
Ext.UpdateManager.defaults.disableCaching = true;
Ext.UpdateManager.defaults.loadScripts = true;
Ext.UpdateManager.defaults.showLoadIndicator = true;
Ext.UpdateManager.defaults.indicatorText = '<div class="loading-indicator">'+Texts.Loading+'</div>'
COOL! Set it once and never set this before update. But one i miss: call a method by default after updating. I need this, because my data-requests dont returns only data, it can contain actions, maybe 'alert' and so on and i want automatically to parse this actions after an update.
The solution: simply create a function-sequence on the prototype for the update() method to prebound the update-event.
Ext.UpdateManager.prototype.update = Ext.UpdateManager.prototype.update.createSequence(function() {
if(typeof this.updatePreset=='undefined') {
this.updatePreset = true;
this.on('update', function(el, o) {
// maybe check the content-type to ensure only use json/javascript content in the form-handler
// get the data and pass it to the form-handler
this.data = eval('('+o.responseText+')');
Lm.Forms.handleResponse(this.data);
}, this, true);
}
});
YUI-EXT rockz!
i short hint: i have seen that the version 1.0 of yui-ext has a nice extension to preset the default for all update-managers like this:
Ext.UpdateManager.defaults.disableCaching = true;
Ext.UpdateManager.defaults.loadScripts = true;
Ext.UpdateManager.defaults.showLoadIndicator = true;
Ext.UpdateManager.defaults.indicatorText = '<div class="loading-indicator">'+Texts.Loading+'</div>'
COOL! Set it once and never set this before update. But one i miss: call a method by default after updating. I need this, because my data-requests dont returns only data, it can contain actions, maybe 'alert' and so on and i want automatically to parse this actions after an update.
The solution: simply create a function-sequence on the prototype for the update() method to prebound the update-event.
Ext.UpdateManager.prototype.update = Ext.UpdateManager.prototype.update.createSequence(function() {
if(typeof this.updatePreset=='undefined') {
this.updatePreset = true;
this.on('update', function(el, o) {
// maybe check the content-type to ensure only use json/javascript content in the form-handler
// get the data and pass it to the form-handler
this.data = eval('('+o.responseText+')');
Lm.Forms.handleResponse(this.data);
}, this, true);
}
});
YUI-EXT rockz!