Author Topic: DELETE problem  (Read 1265 times)

hyh888

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 81
    • View Profile
DELETE problem
« on: November 19, 2021, 04:56:07 pm »
When I select a row in treegrid and press DELETE ,all data in grid are deleted.
When I select a row in grid and press DELETE in common grid, the data in the row(s) are deleted, but the empty row is still there. Is it possible to delete whole row (or rows)?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 5645
    • View Profile
Re: DELETE problem
« Reply #1 on: November 19, 2021, 06:31:59 pm »
[ Only Pro members may read this post. ]

hyh888

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 81
    • View Profile
Re: DELETE problem
« Reply #2 on: November 19, 2021, 07:33:53 pm »
Than you for the help. But I hope pqgrid can fix two problems that I have described . They really make trouble.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 5645
    • View Profile
Re: DELETE problem
« Reply #3 on: November 19, 2021, 08:56:16 pm »
[ Only Pro members may read this post. ]

hyh888

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 81
    • View Profile
Re: DELETE problem
« Reply #4 on: November 20, 2021, 03:10:54 am »
Maybe this is  the best solution now.
When I put some code in beforeCellKeyDown event, it is a little troublesome to get rowIndx list of the rows selected.
Only the last row (in selected rows) can be deleted easily. Is there any easy way to delete all selected rows?

if(event.key=="Delete" ){debugger;
//var Sel = this.Selection().getSelection();//There need be a For Cyclic Sentence to remove the repeated rowindexs.
this.deleteRow({ rowIndx:ui.rowIdx } );
}
« Last Edit: November 20, 2021, 04:21:17 am by hyh888 »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 5645
    • View Profile
Re: DELETE problem
« Reply #5 on: November 20, 2021, 11:03:50 am »
[ Only Pro members may read this post. ]

hyh888

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 81
    • View Profile
Re: DELETE problem
« Reply #6 on: November 20, 2021, 01:23:13 pm »
Thank you, it works.

hyh888

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 81
    • View Profile
Re: DELETE problem
« Reply #7 on: January 12, 2022, 02:56:19 pm »
I found a new problem, when I seclected a cell and press delete key( after adding your code in grid), the whole row is deleted.  I hope that only when the whole row is selected and del-key is pressed then to delete the whole row. Would you like kindly to show me how to fix it?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 5645
    • View Profile
Re: DELETE problem
« Reply #8 on: January 12, 2022, 06:40:00 pm »
[ Only Pro members may read this post. ]

hyh888

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 81
    • View Profile
Re: DELETE problem
« Reply #9 on: January 12, 2022, 07:45:13 pm »
Great! It works. Many thanks for your kindly help.