User (Old forums)MemberMay 3, 2009 at 10:28 pmPost count: 23064
I am using Extensibility Sample and created my own Filtering mecahnism, which is using exact same mechanism of FilterRows & Group By Functions.
Earlier when I was doing Filterings I was creating DataTable with Select Statements to produce correct Resultset for my use and was binding it to grid.
In that case whenever I did grouping the Row summary Count was correct because datasource was exact to my filters.
Since I have started using Extensibility Sample and instead of creating new Filtered DataSet I am using Visible state True / False Group by Summary count is not what it represent.
I have 5 Rows of Field A = “ABC”.
If I select Field A with ABC value and GroupBy Field A then the group Summary Rows Shows me Row Count of 5, which is Correct
Then I go and Add Second Filter which is Field B = “XYZ” where the Row Count is 3.
List Rows are filtered to 3 but the Groupby Summary Rows Count is still showing 5.
Is there anyway I can get the Count of GroupRows which is to the Filtered Rows?
You can easily replicate this one by running the Extensibility sample.
Pick Employee = “ANDREW”
Then GroupBy Employee (Result, list Shows 8 Rows and GroupBy Summary shows “Employee: Andrew – 8 item(s)”)
Then select ShipCountry Filter to Germany, (Result, list Shows 3 Rows and GroupBy Summary shows “Employee: Andrew – 8 item(s)”)
My Requirement is to Show Following:
List should show 3 Rows
GroupBy Summary shows “Employee: Andrew – 3 item(s)”
What is the best way to achieve that, this is causing issues to our functionality and there is not a single simpler way for me to achieve it..
Imported from legacy forums. Posted by NR (had 1710 views)User (Old forums)MemberMay 5, 2009 at 3:15 pmPost count: 23064
The best is to filter the source, but if you can’t do this for whatever reason, we have a very ugly workaround.
First, you need to add an unbound column with its Visible property set to false. Second, subscribe to the AddingDataRow event, and in the event handler, set the value of the cell corresponding to this column to a reference to a static object (so no unnecessary memory is used). Third, set the TitleFormat property on the GroupManagerRow to the stat function %COUNT:%, using the unbound invisible column as the target of the function.
Finally, when hiding a row, you will need to set the cell value of the hidden column to null. When showing a row, you will need to set it back to the static object.
This will display the right row count, because the COUNT function does not add cells with null values.
Note that the grid does not offer a filter feature. We provide this as a sample, with no guarantee it works in all scenarios. It is a basic implementation, that needs to be incremented on to become robust.
Imported from legacy forums. Posted by André (had 1512 views)
- You must be logged in to reply to this topic.