EhLib.Com
https://forum.ehlib.com/en/

About "dghIncSearch" Search
https://forum.ehlib.com/en/viewtopic.php?f=5&t=1020
Page 1 of 2

Author:  Luciano_F [ 31 Jan 2020, 12:26 ]
Post subject:  About "dghIncSearch" Search

Hello I would like to know how to do it when the option "dghIncSearch" is checked when searching in a grid, selecting all occurrences and filtering only the one found in "SearchPanel FilterOnTyping"

Thankful.

Author:  EhLibSupport [ 04 Feb 2020, 16:51 ]
Post subject:  Re: About "dghIncSearch" Search

Hello

Quote:
when the option "dghIncSearch" is checked ...selecting all occurrences

Searching text for dghIncSearch is not public, so you should use Crack to access protected fields.
Next code take Searching text and select all the rows in the grid which satisfy the search text.

Code:
type
  TDBGridEhCrack = class(TDBGridEh);

procedure TForm1.Button1Click(Sender: TObject);
var
  SearchText: String;
  bm: TBookmark;
  s: String;
begin
  SearchText := TDBGridEhCrack(DBGridEh1).FInplaceSearchText;
  MemTableEh1.DisableControls;
  while not MemTableEh1.Eof do
  begin
    s := MemTableEh1.FieldByName('Continent').AsString;
    if (Copy(s, 1, Length(SearchText)) = SearchText) then
    begin
      DBGridEh1.SelectedRows.AppendBookmark(bm);
      bm := MemTableEh1.Bookmark;
    end;
    MemTableEh1.Next;
  end;
  MemTableEh1.EnableControls;
end;


Quote:
filtering only the one found in "SearchPanel FilterOnTyping"

When working with SearchPanel in FilterOnTyping mode, the filter already filters data when user types the text.
Why filter them again?
To filter only one current record, you just have to get the key of the current record and generate the text for the Filter property.

Code:
procedure TForm1.Button2Click(Sender: TObject);
var
  key: String;
begin
  key := MemTableEh1.FieldByName('Name').AsString;
  MemTableEh1.Filter := 'Name = ''' + key + '''';
  MemTableEh1.Filtered := True;
end;


Attachments:
sshot-73.png
sshot-73.png [ 12.49 KiB | Viewed 2486 times ]

Author:  Luciano_F [ 04 Feb 2020, 19:25 ]
Post subject:  Re: About "dghIncSearch" Search

I don't want to use "SearchPanel" Mode
I want to use "dghIncSearch" and do two things

1º Select all the yellow Records that were found.

2nd Summarize the records as you type something like "FilterOnTyping" but using "dghIncSearch"

Author:  Luciano_F [ 04 Feb 2020, 19:49 ]
Post subject:  Re: About "dghIncSearch" Search

I tested the code:

Code:
type
  TDBGridEhCrack = class(TDBGridEh);

procedure TForm1.Button1Click(Sender: TObject);
var
  SearchText: String;
  bm: TBookmark;
  s: String;
begin
  SearchText := TDBGridEhCrack(DBGridEh1).FInplaceSearchText;
  MemTableEh1.DisableControls;
  while not MemTableEh1.Eof do
  begin
    s := MemTableEh1.FieldByName('Continent').AsString;
    if (Copy(s, 1, Length(SearchText)) = SearchText) then
    begin
      DBGridEh1.SelectedRows.AppendBookmark(bm);
      bm := MemTableEh1.Bookmark;
    end;
    MemTableEh1.Next;
  end;
  MemTableEh1.EnableControls;
end;


it didn't work and the big problem with this code is that I will have to implement all Grids and Columns for the entire system, I wanted a more generic code, to work automatically for the entire system. I believe you already have the solution as it would be to implement the "SearchPanel" functionality in "dghIncSearch"

In this link below I put a Video for you to better understand what I need.
I used a Trial version of QuantumGrid "DevExpress" that does it automatically, I just needed to activate a property for that.

https://mega.nz/#!c2hXxazb!OqF6qW7C_GZbmGuiDW5R87Ly-Qb1aeL2uDWJ6cBgEPU

Author:  EhLibSupport [ 07 Feb 2020, 22:29 ]
Post subject:  Re: About "dghIncSearch" Search

Hello

About dghIncSearch with filtering and highlighting all the data found, it looks reasonable.
But the video is not all clear.

RowSelect mode is set on the Video in the grid, but when typing, the search and highlighting goes only along the second column.

Do you need to be able to adjust by which column the search should be in RowSelect mode, or will it be sufficient to make a mode in all columns?
Or in RowSelect mode always do the first column?
Or do you need some sort of additional property to select a column?

---
I think we can extend the SearchPanel mode and add the SearchPanel.Location = splInplace mode.
When SearchPanel will not be visible, but it will automatically work when typing in a grid cell.

But this can only be added to the next version of the library, but not to the next Build.

Author:  Luciano_F [ 08 Feb 2020, 00:37 ]
Post subject:  Re: About "dghIncSearch" Search

This example I sent you from devexpress I just clicked the mouse on the second column and started typing; I never clicked on the first column.
Thus it is necessary that the selection of records is only in the records found only in the second column which is where I am writing.

My problem is that a software competitor presented software with this type of search and now a client of mine wants this type of search.
When you say put this search in the next version I see that it will take time, if you could release it in a builder before I would be very grateful.

Author:  danieldavila [ 10 Feb 2020, 11:31 ]
Post subject:  Re: About "dghIncSearch" Search

This would be a very interesting feature, and we would definitely use it too.

Author:  Luciano_F [ 19 Feb 2020, 10:32 ]
Post subject:  Re: About "dghIncSearch" Search

hello functionality was created in Version 9.5 Beta
I'm testing it and it was great.

Author:  danieldavila [ 20 Feb 2020, 13:10 ]
Post subject:  Re: About "dghIncSearch" Search

Luciano_F wrote:
hello functionality was created in Version 9.5 Beta
I'm testing it and it was great.

Como você conseguiu acesso ao beta?

Author:  danieldavila [ 20 Feb 2020, 13:11 ]
Post subject:  Re: About "dghIncSearch" Search

EhLibSupport wrote:
Hello

About dghIncSearch with filtering and highlighting all the data found, it looks reasonable.
But the video is not all clear.

RowSelect mode is set on the Video in the grid, but when typing, the search and highlighting goes only along the second column.

Do you need to be able to adjust by which column the search should be in RowSelect mode, or will it be sufficient to make a mode in all columns?
Or in RowSelect mode always do the first column?
Or do you need some sort of additional property to select a column?

---
I think we can extend the SearchPanel mode and add the SearchPanel.Location = splInplace mode.
When SearchPanel will not be visible, but it will automatically work when typing in a grid cell.

But this can only be added to the next version of the library, but not to the next Build.



When the version 9.5 it will be release?

Page 1 of 2 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/