Author Topic: New Row add after selected (Focus) cell/row  (Read 1836 times)

Jignesh

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 46
    • View Profile
New Row add after selected (Focus) cell/row
« on: January 09, 2020, 12:29:59 pm »
Hi Paramvir,

How to add new row after selected cell/row of grid.

Currently, It added end of grid. Below is my code:

var rowData = {}; //empty row
var rowIndx = grid.addRow({ rowData: rowData });


Thank you,
Jignesh

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6113
    • View Profile
Re: New Row add after selected (Focus) cell/row
« Reply #1 on: January 09, 2020, 09:59:00 pm »
Pass rowIndx parameter to addRow method.

In case of cell selections, selected rowIndx can be obtained from Selection() API

Code: [Select]
var ri = grid.Selection().address()[0].r1;
grid.addRow({
          rowIndx: ri + 1,
          newRow: rowData
})

In case of row selections, rowIndx can be obtained from SelectRow() API
« Last Edit: January 09, 2020, 10:03:43 pm by paramvir »