Author Topic: How to create a superset of 2 or more rows?  (Read 815 times)

smarthealthclubs

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 7
    • View Profile
How to create a superset of 2 or more rows?
« 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?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: How to create a superset of 2 or more rows?
« Reply #1 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.