Custom merge for groups

Posted by: ozan.bilgic on 31 August 2023, 1:53 am EST

    • Post Options:
    • Link

    Posted 31 August 2023, 1:53 am EST - Updated 31 August 2023, 1:58 am EST

    Hello I created some custom merges, and because of this reason I lost a feature which I cannot do customly.

    On the picture below, we can see merges of groups “Closed won” merged with 2 cells, “Amount” is closed, but others not.

    On my code, I just have this:

    if (row instanceof GroupRow) {

    return null;

    }

    but somehow I need to improve this to get the custom behaviour from wijmo for groups. Currently, I see borders on all cells.

    Thanks.

  • Posted 31 August 2023, 5:04 pm EST

    Hi,

    As per our understanding, you are implementing some custom merging in your flexgrid and want to remove the merging for the group rows in the grid, if so, then you can add the following code to your custom merger manager class -

    getMergedRange(panel, r, c, clip = true) {
    
            // to remove merging for group rows
            if(panel.rows[r] instanceof wjGrid.GroupRow){
                return null;
            }
    
        }

    You can also refer to the following sample demonstrating the same - https://jscodemine.grapecity.com/share/CsC4bzVqnUyIunWXZ4I1FQ/

    In case, if we are missing something, please try to update the above sample to replicate your issue and share it with us, so that we can have a better understanding of the issue and assist you accordingly.

    Regards

  • Posted 31 August 2023, 6:22 pm EST - Updated 31 August 2023, 6:27 pm EST

    Hi sorry for the confusion. I use “mergeManager” prop, and I implemented my own custom class.

    Before my implementation, groups were shown like this:

    if the cell is empty, then it doesn’t have left border. but if it is not empty then there are borders.

    This is after I implemented “mergeManager” prop



    You can see left borders are always there no matter cell is empty or not.

    I want to know the logic to remove left borders as on the first picture to implement to my custom merge manager.

    Thanks.

  • Posted 31 August 2023, 9:08 pm EST

    Hi Ozan,

    In that case, you can use the default mergeManager’s ‘getMergedRange’ method to merge group row cells like this -

    export class CustomMergeManager extends wjGrid.MergeManager {
        getMergedRange(panel, r, c, clip = true) {
            // merging for group rows
            if (panel.rows[r] instanceof wjGrid.GroupRow) {
                return super.getMergedRange(panel,r,c,clip);
            }
    
            // add code for custom merging here
    
        }
    }

    Please refer to the following updated sample for the same - https://jscodemine.grapecity.com/share/6_abWrIfYkGSpRxkTAqSXw/

    In case, you face any issues, please let us know.

    Regards

  • Posted 31 August 2023, 9:46 pm EST

    Super. Thank you very much

Need extra support?

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

Learn More

Forum Channels