
IframeRowExpander = function(config, previewURL){
    IframeRowExpander.superclass.constructor.call(this, config, previewURL);
    this.previewURL = previewURL;
    this.enableCaching = false;   
}
 
Ext.extend(IframeRowExpander, Ext.grid.RowExpander, {
    getBodyContent : function(record, index){
      var body = '<div id="IfRE' + record.data.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("AjRE" + options.objId).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 = '<div id="IfREwait' + record.data.id + '"><img src="/k3/css/loading.gif" width="16" height="16" align="absmiddle"/> chargement...</div><iframe frameborder="0" width="100%" height="400px" src="'+this.previewURL + record.data.id+'" style="background-color:#FFF; display:none;" onLoad="this.style.display=\'block\'; Ext.getDom(\'IfREwait' + record.data.id +'\').style.display=\'none\';"></iframe>';
			return true;
        } else{
            return false;
        }
    }
});