Recent

Author Topic: [Solved] RxDBGrid bug  (Read 369 times)

lainz

  • Hero Member
  • *****
  • Posts: 4689
  • Web, Desktop & Android developer
    • https://lainz.github.io/
[Solved] RxDBGrid bug
« on: February 12, 2025, 07:48:27 pm »
Hi, attached a test project that shows partially the bug I'm experiencing.

When marking the first and second checkbox, then making a search, then deleting the search, only the first checkbox remains checked. That's all I can reproduce on a small project, but this is bigger, it sometimes duplicates the 'Name' field into the second field. And sometimes I do a filter and it gives 2 items duplicated insted of one.

Seems that there's a problem with filtering the grid...
« Last Edit: February 13, 2025, 01:20:34 pm by lainz »

lainz

  • Hero Member
  • *****
  • Posts: 4689
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: RxDBGrid bug
« Reply #1 on: February 12, 2025, 07:51:32 pm »
Anothet attachment, the same demo with DBGrid (not Rx) works fine.


paweld

  • Hero Member
  • *****
  • Posts: 1297
Re: RxDBGrid bug
« Reply #2 on: February 13, 2025, 05:22:46 am »
In my opinion, there is no error here, and in my case both examples (RxDBGrid and DBGrid behave equally).
As you check the box, you set the DataSet in dsEdit state, going straight to the search box does not save the changes, and last checked checkbox disappears when you refresh the DataSet.
You can solve this either by manually clicking another row after checking the box (then the changes will be saved) or programmatically when exiting the (Rx)DBGrid control check if the DataSet is in edit mode and if so, save the changes.

Solution:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.RxDBGrid1Exit(Sender: TObject);
  2. begin
  3.   if MemDataset1.State = dsEdit then
  4.     MemDataset1.Post;
  5. end;
Best regards / Pozdrawiam
paweld

lainz

  • Hero Member
  • *****
  • Posts: 4689
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: RxDBGrid bug
« Reply #3 on: February 13, 2025, 01:20:15 pm »
Thanks paweld! That works for me.

Many thanks for your help!!  :)

 

TinyPortal © 2005-2018