Ok: i've finally isolated the problem and solved in a very dirty (but effective) way:
When I invoke $('#tt').panel('refresh',page), I load several elements:
- a main window (normally a datagrid)
- several auxiliar dialogs ( either forms, or subgrids)
These auxiliar dialogs are loaded in "closed" state, and activated by mean of linkbuttons from main datagrid window's toolbar.
When I want to change main window (and also related auxiliar dialogs), I invoke $('#tt').panel('clear'), that effectively clears.... main panel, not auxiliar dialogs.
So next load of same window and their slaves, gives DOM with duplicated entries... and thus are shown on rendering
This bug only affects auxiliar datagrid toolbars and footers. Other components are silently overwritten and works as expected
My dirty solution: provide and store a list of auxiliar dialogs to be cleared on next reload of main page:
/**
* Load html contents from 'page' URL and set as contents on '#contenido' tag
* @param page URL where to retrieve HTML data
* @param title new page title
* @param slaves list of dialogs to .clear() on next loadContents
*/
var slaveDialogs = new Object();
function loadContents(page,title,slaves) {
$('#mymenu').panel('collapse');
$.each(slaveDialogs,function(key,val) { alert(val); $(val).dialog('panel').panel('clear'); } );
slaveDialogs = (slaves===undefined)? {} : slaves;
$('#contenido').panel('clear');
$('#contenido').panel('refresh',page);
setHeader(title);
}
This code works fine, but requires a global variable, explicit list of dialogs to be cleared, and restricts auxiliar windows to be declared as dialogs.
Any ideas for a better solution?
Juan Antonio