Hi is there any way to get all cells closed but one if the grid has multimode enabled?
I tried with following functions (most of the code I got it from ‘setIcon’ function myAcc.cells(id).setIcon(“icon.png”); ):
dhtmlXAccordionCell.prototype.setMaximizeCell = function(icon) {
var acc=this.acc;
var _cell = this;
var dhx_cell_hdr_max = ' position:absolute; top:6px; right:4px; width:16px; height:16px; margin-right:20px; cursor:pointer;';
var t = this.cell.childNodes[this.conf.idx.hdr];
if (t.lastChild.className != "dhx_cell_hdr_max") {
t.lastChild.className += " dhx_cell_hdr_max";
var k = document.createElement("IMG");
k.className = "dhx_cell_hdr_max";
k.style.cssText += dhx_cell_hdr_max;
k.addEventListener('click',function (e) {
// avoid event propagation so that cell is not clicked and close/open cell is not triggered.
e = e||event;
if (typeof e.stopPropagation != "undefined")e.stopPropagation();
else e.cancelBubble = true;
acc.forEachItem(function (cell) {
cell.close();
});
_cell.open();
});
t.insertBefore(k,null); // insert last;
k = null;
}
t.lastChild.src = this.acc.conf.icons_path+icon;
t = null;
};
and :
dhtmlXAccordionCell.prototype.setMaximizeCell = function(icon) {
var acc=this.acc;
var _cell = this;
var dhx_cell_hdr_max = ' position:absolute; top:6px; right:4px; width:16px; height:16px; margin-right:20px; cursor:pointer;';
var t = this.cell.childNodes[this.conf.idx.hdr];
if (t.lastChild.className != "dhx_cell_hdr_max") {
t.lastChild.className += " dhx_cell_hdr_max";
var k = document.createElement("IMG");
k.className = "dhx_cell_hdr_max";
k.style.cssText += dhx_cell_hdr_max;
k.addEventListener('click',function (e) {
// avoid event propagation so that cell is not clicked and close/open cell is not triggered.
e = e||event;
if (typeof e.stopPropagation != "undefined")e.stopPropagation();
else e.cancelBubble = true;
acc.forEachItem(function (cell) {
if(cell.isOpened())
acc._hdrClick(cell.getId());
});
if(!_cell.isOpened())
acc._hdrClick(_cell.getId());
});
t.insertBefore(k,null); // insert last;
k = null;
}
t.lastChild.src = this.acc.conf.icons_path+icon;
t = null;
};
I also tried an external function like that (in this example the accordion has only 4 cells a,b,c,d) and this didn’t work either:
function openCellCloseOther(cellId){
accordionBarraEines.cells('a').close();
accordionBarraEines.cells('b').close();
accordionBarraEines.cells('c').close();
accordionBarraEines.cells('d').close();
accordionBarraEines.cells(cellId).open();
}
In all this cases, it almost works correctly but something fails. The opened cell does not expand to its maximum height, or all cells stay closed.
Thanks ind advance.