Posted 4 March 2019, 9:16 am EST
Hi .
I am going to check if a selected cell is grouping or not?
please watch this image.
https://drive.google.com/file/d/152czqQ0lXYzFOANBwqvX7oEt5lhEyRKX/view?usp=sharing
How can I check this?
Thanks.
Forums Home / Spread / SpreadJS
Posted by: arnoldbendaa on 4 March 2019, 9:16 am EST
Posted 4 March 2019, 9:16 am EST
Hi .
I am going to check if a selected cell is grouping or not?
please watch this image.
https://drive.google.com/file/d/152czqQ0lXYzFOANBwqvX7oEt5lhEyRKX/view?usp=sharing
How can I check this?
Thanks.
Posted 5 March 2019, 2:21 am EST
Hi Arnold,
To get the group state for the selected cell, we need to use the find(rowIndex/columnIndex,groupLevel) method for rowOutlines or columnOutlines property.
For reference, please refer to the attached sample and the following code snippet:
function isGroupedCell(){
var activeSheet= GC.Spread.Sheets.findControl(document.getElementById("ss")).getActiveSheet();
var rowOutLine= activeSheet.rowOutlines;
var selection= activeSheet.getSelections()[0];
var str="";
for(var i=0;i<selection.rowCount;i++){
var row=selection.row+i;
for(var j=0;j<selection.colCount;j++){
var col=selection.col+j;
str+="Cell ("+row+", "+col+" ) =>";
str+= (rowOutLine.find(row,0) ? "Grouped" : "UnGrouped" )+"\n";
}
}
alert(str);
}
Hope it helps!
Regards,
Manish Gupta