Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » DoSum(), DoAvg(), etc... and search operations
DoSum(), DoAvg(), etc... and search operations [message #23382] |
Thu, 15 October 2009 17:13 |
jeremy_c
Messages: 175 Registered: August 2007 Location: Ohio, USA
|
Experienced Member |
|
|
Hello,
I use to define WhenUpdateSummary and did my own suming but when searching to fix my problem I found DoSum(), DoAvg(), etc... I now use that, much easier!
Anyway, my root problem/desire is to change the summary when the person begins to search. I noticed that when I had my own WhenUpdateSummary defined, that it was called each time the search was revised, which is good but I could not figure out how to tell if a given row was displayed in the search results or hidden from the search results.
I then found DoSum() and friends hoping that it would handle it interally but it does not seem to pay attention to the items displayed status either.
So, my question is, how can I make the summary display only what is shown not other items that are hidden due to a search. Now, the idea is also that if there is no active search than the whole grid would be summed of course. I'd like to be able to do this with the build in DoSum and friend functions but will use a WithUpdateSummary event function if necessary.
Thanks,
Jeremy
|
|
|
Re: DoSum(), DoAvg(), etc... and search operations [message #23388 is a reply to message #23382] |
Thu, 15 October 2009 22:45 |
|
To check is a given row is displayed or not use this code:
grid.GetRow(n).IsHidden();
To check if row matches a search pattern:
grid.GetRow(n).IsFound();
As for DoSum() etc - it's fixed now, it sums only visible rows. Patch will be available tomorrow together with sorting fix.
|
|
|
|
Re: DoSum(), DoAvg(), etc... and search operations [message #23390 is a reply to message #23388] |
Thu, 15 October 2009 23:15 |
jeremy_c
Messages: 175 Registered: August 2007 Location: Ohio, USA
|
Experienced Member |
|
|
Also, on the DoMin() and DoMax() type functions, can this be added to GridCtrl.cpp around line 4627 (SyncSummary function)? It allows the DoMin() and DoMax() summary options to work on Dates.
else if (IsDateTime(v))
{
switch(sop)
{
case SOP_MIN:
if (((Date) v) < ((Date) t))
t = v;
break;
case SOP_MAX:
if (((Date) v) > ((Date) t))
t = v;
break;
case SOP_SUM:
case SOP_AVG:
t = v;
break;
}
}
Jeremy
[Updated on: Thu, 15 October 2009 23:17] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Fri Apr 26 10:52:57 CEST 2024
Total time taken to generate the page: 1.11757 seconds
|