Author Topic: How to correct way to delete multiple selected rows?  (Read 2053 times)

Fraan83

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 9
    • View Profile
How to correct way to delete multiple selected rows?
« on: November 04, 2019, 03:39:20 pm »
Hi, i've to delete multiple selected rows.
i tried to make some code but doesn't work properly.
(it doesn't delete all lines, but only the first)

Code: [Select]
var grid = $('#grid_prodotti').pqGrid("getInstance").grid;
var sel = grid.SelectRow().getSelection();
var rIndex;

for (i= 0; i < sel.length; i++) {
  rIndex = sel[i]['rowIndx'];
  grid.deleteRow({ rowIndx: rIndex  })
}


how is the correct way to delete multiple row?
thank you

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: How to correct way to delete multiple selected rows?
« Reply #1 on: November 04, 2019, 04:34:11 pm »
That's simple:

Code: [Select]
grid.deleteRow({
rowList: grid.SelectRow().getSelection()
})