ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: smarthealthclubs on November 12, 2021, 07:34:08 pm

Title: How to create a superset of 2 or more rows?
Post by: smarthealthclubs on November 12, 2021, 07:34:08 pm
How can we create a superset of 2 or more rows and draw a rectangular border to the superset?
Title: Re: How to create a superset of 2 or more rows?
Post by: paramvir on November 14, 2021, 08:40:53 am
Please refer to this example https://paramquery.com/pro/demos/import-xlsx

Select multiple rows, choose context menu -> Border -> All selection edges.

you may have to adapt this source code for your requirement.

Code: [Select]
action: function () {
    var grid = this,
        color = $(".border", grid.toolbar()).spectrum('option', 'color');
    grid.Selection().address().forEach(function (addr) {
        var r1 = addr.r1, c1 = addr.c1, r2 = addr.r2, c2 = addr.c2,
            obj = {
                left: grid.Range({ r1: r1, r2: r2, c1: c1, c2: c1 }),
                top: grid.Range({ r1: r1, r2: r1, c1: c1, c2: c2 }),
                right: grid.Range({ r1: r1, r2: r2, c1: c2, c2: c2 }),
                bottom: grid.Range({ r1: r2, r2: r2, c1: c1, c2: c2 })
            };
        for (var key in obj) {
            obj[key].toggleStyle("border-" + key, ["1px solid " + color, ""])
        }
    });                                   
}
      

Please let me know if you need further assistance.