Components for Delphi and C++ Builder.

Go to Russian forum
Go to EhLib.com
It is currently 29 Mar 2024, 02:20

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: 06 Jun 2012, 12:24 
Offline

Joined: 09 Feb 2012, 17:05
Posts: 124
Hello,

In a gridEh I have a lookUpField with an editButton to open a comboBox

In the event OnEditButtonClick I do a filter on the lookup data
It works, data displayed in the comboBox are filtered as I want
My problem is that I don't know where to set filtered := false after closing the combox !
To solve that, I need a new event such column.OnDropDownBoxCloseUp ...

May be you see an other solution ...

Thank you
Rico


Top
 Profile  
 
PostPosted: 12 Jun 2012, 19:13 
Offline
Администратор

Joined: 22 Dec 2011, 20:19
Posts: 335
Hello Rico

Could describe the source task that you want to solve as I see several problems here:

1.
Lookup mode works even if you don't show DroppedDown window with lookup list.
If you type a text into a DBGridEh cell (that is bound to lookup field) the grid substitutes a string from lookup list on every new typed char, even if the lookup list is not dropped down.

2. If you apply filter on DataSet for Field.LookupDataSet then it will cause to refresh list values in the whole column. So if filter hide values that were visible for some records in dataset, after appling filter some cells in the column will be empty as lookup values would be found for data values.

If in your case there are no such problems then could you create demo project where it is demonstrated how you use and apply filter.

Best regards
Admin.

_________________
Best regards
Admin


Top
 Profile  
 
PostPosted: 13 Jun 2012, 15:40 
Offline

Joined: 09 Feb 2012, 17:05
Posts: 124
Hello Dmitry,

In the attached project, you a have a real case
In my application I need to set differents types of reports by customer
Some customers want different invoice report by exemple (with header or not, some descriptions, groups etc ...)
So, in the grid, the end user can choose report for invoice, but also for order report and quotation reports and this is my problem : I want that user choose a invoice report for report type invoice and nothing else (nor a order report by example)


Quote:
1.
Lookup mode works even if you don't show DroppedDown window with lookup list.
If you type a text into a DBGridEh cell (that is bound to lookup field) the grid substitutes a string from lookup list on every new typed char, even if the lookup list is not dropped down.


Yes, you saw a problem ! and I don't how to solve it, but it's not too important (filter lookup is better than nothing)

Quote:
2. If you apply filter on DataSet for Field.LookupDataSet then it will cause to refresh list values in the whole column. So if filter hide values that were visible for some records in dataset, after appling filter some cells in the column will be empty as lookup values would be found for data values.


No, I don't have this problem (see my project)

Quote:
If in your case there are no such problems then could you create demo project where it is demonstrated how you use and apply filter.


A little demo project (probably my best demo :lol: )
Attachment:
lookupFilterEh.zip [12.27 KiB]
Downloaded 266 times

Note : Check Active filter in the project to see what I need

Best regards
Rico


Top
 Profile  
 
PostPosted: 15 Jun 2012, 09:04 
Offline

Joined: 09 Feb 2012, 17:05
Posts: 124
Hello Dmitry,

look at this project please
Perhaps you have any other way to do that ...

Rico


Top
 Profile  
 
PostPosted: 30 Jun 2012, 16:21 
Offline
Администратор

Joined: 22 Dec 2011, 20:19
Posts: 335
Hello, Rico

I modified your project. So now it works and does't requary new events.

In the modification:

1. I commented code in procedure TForm1.DBGridEh2Columns1EditButtonClick(Sender: TObject;
2. Added new MemTableEh and DataSource, (ReportForDropDownList, dsReportForDropDownList). It a copy of (ReportForDropDownList is a copy of MemTableEh - REPORT). ReportForDropDownList is intended to be filtered when user navigate throw the main DataSet - CUST_REPORT).
While the default MemTableEh - REPORT will work as classic list of values for LookupField - CUST_REPORTLK_REPORT.

3. Filter Data in MemTableEh:ReportForDropDownList into the event DataSource2DataChange.

4. The key point is assigning DataSource: dsReportForDropDownList to the property
DBGridEh2.Columns[1].DropDownBox.ListSource.

TCoulmnEh.DropDownBox.ListSource is special property to assign reference to the special list for DropDownList when TCoulmnEh.Field is a Lookup Field.

Now it work always regardless of how the DropDownList became visible, by mouse or by key Alt+Down.
It will work even if DropDownList is not visible and user type text in the inplace editor.

Best regards
Admin


Attachments:
lookupFilterEhNew.rar [4.37 KiB]
Downloaded 274 times

_________________
Best regards
Admin
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group