How can I check if the selected cell is grouping or not?

Posted by: arnoldbendaa on 4 March 2019, 9:16 am EST

    • Post Options:
    • Link

    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

    basicGroup.zip

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels