AjaxRowExpander = function(config, previewURL){
    AjaxRowExpander.superclass.constructor.call(this, config, previewURL);
    this.previewURL = previewURL;
    this.enableCaching = false;
}
 
Ext.extend(AjaxRowExpander, Ext.grid.RowExpander, {
    getBodyContent : function(record, index){
        var body = '<div id="AjRE' + record.id + '"><img src="/k3/css/loading.gif" width="16" height="16" align="absmiddle"/> chargement...</div>';
        Ext.Ajax.request({
           url: this.previewURL + record.data.id,
           disableCaching: true,
           success: function(response, options) {
               //Ext.getDom('articleReportsPreview' + options.objId).innerHTML = response.responseText; // original
			  Ext.getDom("AjRE"+record.id).innerHTML = response.responseText;
           },
           failure: function(error) {
               alert(DWRUtil.toDescriptiveString(error, 3));
           },
           objId: record.id
        });
 
        return body;
    },
    beforeExpand : function(record, body, rowIndex){
        if(this.fireEvent('beforeexpand', this, record, body, rowIndex) !== false){
            body.innerHTML = this.getBodyContent(record, rowIndex);
            return true;
        } else{
            return false;
        }
    }
});