<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://helpcentral.componentone.com/CS/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Grid Unusable with one column Subtotal</title><link>http://helpcentral.componentone.com/CS/winforms_31/f/8/p/81999/228048.aspx#228048</link><description>Scenario: - Grid bound to a dataview with 20000 entries, sorted on a Street Column. -Each Row has around 20 columns, customer information, each customer has a &amp;quot;street&amp;quot; column, we group customers by &amp;quot;street&amp;quot; column (a simple string</description><dc:language /><generator>Telligent Community (Build: 5.5.134.11459)</generator><item><title>Re: Grid Unusable with one column Subtotal</title><link>http://helpcentral.componentone.com/CS/thread/228386.aspx</link><pubDate>Fri, 05 Feb 2010 05:30:22 GMT</pubDate><guid isPermaLink="false">6ffc9ae0-0270-4839-b826-46696419445e:228386</guid><dc:creator>Bernardo</dc:creator><description>&lt;p&gt;Hmmmm...&lt;/p&gt;

&lt;p&gt;The grid hides and shows rows when nodes are collapsed/expanded. I think when you add a row to a group that is collapsed, the new row is not being collapsed.&lt;/p&gt;

&lt;p&gt;I would try scanning all the nodes after each change (you are already doing that) and setting the node&amp;#39;s Collapsed property to false, then back to true. That should fix the collapsed state for all child nodes.&lt;/p&gt;

&lt;p&gt;The caveat here is I think you will need to use an update flag and avoid handling the AfterCollapse/Expand event when the action comes from the code.&lt;/p&gt;

&lt;p&gt;Hope this suggestion works...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Grid Unusable with one column Subtotal</title><link>http://helpcentral.componentone.com/CS/thread/228263.aspx</link><pubDate>Tue, 02 Feb 2010 21:24:19 GMT</pubDate><guid isPermaLink="false">6ffc9ae0-0270-4839-b826-46696419445e:228263</guid><dc:creator>assassin316</dc:creator><description>&lt;p&gt;Thanks for the sample Bernardo,&lt;/p&gt;
&lt;p&gt;i applied the sample to the gridtester, applied your recommendation to maintain Collapsed Nodes from a previous post, and my own collection to maintain current nodes in the Grid. I also added code to be able to calculate the caption of the node we are adding/removing&amp;nbsp;(i had to calculate it at the end, if you have a better way to determine the caption when adding or removing nodes i am all ears!)&lt;/p&gt;
&lt;p&gt;The problem i am having is, that if the node is collapsed and a row is added, it is added after the node! there will be a node collapsed with a plus sign, then the new row is put after the node not inside, some weird drawing problem i am guessing?&lt;/p&gt;
&lt;p&gt;Just run the tester, group by Value1 in the grouping combobox, collapse first node with Value1 of P1, add a node with Value1 P1 and notice where and how it is drawn.&lt;/p&gt;
&lt;p&gt;Any idea what the problem here is?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Grid Unusable with one column Subtotal</title><link>http://helpcentral.componentone.com/CS/thread/228235.aspx</link><pubDate>Tue, 02 Feb 2010 15:14:01 GMT</pubDate><guid isPermaLink="false">6ffc9ae0-0270-4839-b826-46696419445e:228235</guid><dc:creator>assassin316</dc:creator><description>&lt;p&gt;The sample provided does work, however&amp;nbsp;the biggest problem i encounter is that with the attached sample i loose the group caption which is the value of the column grouped by.&lt;/p&gt;
&lt;p&gt;and unfortunatly it is not as easy as expected to get that group caption, any ideas?&lt;/p&gt;
&lt;p&gt;(just replace my afterDataRefresh with yours in my sample)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;PS: managed to do it by updating the caption using the value from the next row, with a special case for the first node addition.&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff"&gt;Me&lt;/font&gt;&lt;font size="2"&gt;.Rows(i).Node.Data = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Me&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.Rows(i + 1)(m_colGroups(0).Name)&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Now i need to apply the algorithm to a multi group scenario.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Grid Unusable with one column Subtotal</title><link>http://helpcentral.componentone.com/CS/thread/228099.aspx</link><pubDate>Sat, 30 Jan 2010 03:04:24 GMT</pubDate><guid isPermaLink="false">6ffc9ae0-0270-4839-b826-46696419445e:228099</guid><dc:creator>Bernardo</dc:creator><description>I made a simple app to show the approach I suggested.

I hope it helps.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Grid Unusable with one column Subtotal</title><link>http://helpcentral.componentone.com/CS/thread/228093.aspx</link><pubDate>Sat, 30 Jan 2010 00:18:37 GMT</pubDate><guid isPermaLink="false">6ffc9ae0-0270-4839-b826-46696419445e:228093</guid><dc:creator>Bernardo</dc:creator><description>&lt;p&gt;I don&amp;#39;t fully understand the problem, but I think I have a good general idea of what&amp;#39;s going on.&lt;/p&gt;

&lt;p&gt;The grid does not manage the subtotals automatically, it only adds them for you. If you had only a few hundred items, this would be fast enough that you could do it for any change in the data.&lt;/p&gt;

&lt;p&gt;But in the sample you sent, there are 10 thousand rows, and the grid is set up so there&amp;#39;s one subtotal per row. That means every time anything changes, you are deleting 10 thousand old rows and inserting 10 thousand new ones. That takes a couple of seconds (about 2.5 on my machine), which is a lot since it happens after every change.&lt;/p&gt;

&lt;p&gt;I would suggest a different solution in this case. Instead of removing and re-creating all totals on every change, I would try enumerating the grid rows and removing/inserting only the nodes that are needed. The logic will be slightly more complicated, but performance will improve a lot.&lt;/p&gt;

&lt;p&gt;I could write a sample showing this if you need help, just let me know.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Grid Unusable with one column Subtotal</title><link>http://helpcentral.componentone.com/CS/thread/228073.aspx</link><pubDate>Fri, 29 Jan 2010 15:25:51 GMT</pubDate><guid isPermaLink="false">6ffc9ae0-0270-4839-b826-46696419445e:228073</guid><dc:creator>assassin316</dc:creator><description>&lt;p&gt;I attached a sample application that simulate the problem, please note how long the stopwatch is taking on an add/delete/move&lt;/p&gt;
&lt;p&gt;Granted i do not have 30000 node (around 10000) but i do have much more datarefreshes.&lt;/p&gt;
&lt;p&gt;Basically i am lookign for a way to manually delete nodes, add nodes and move rows around (on a databound grid) after the datarefresh instead of calculating the subtotals.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Grid Unusable with one column Subtotal</title><link>http://helpcentral.componentone.com/CS/thread/228054.aspx</link><pubDate>Thu, 28 Jan 2010 23:23:38 GMT</pubDate><guid isPermaLink="false">6ffc9ae0-0270-4839-b826-46696419445e:228054</guid><dc:creator>assassin316</dc:creator><description>&lt;p&gt;After adding a stopwatch to calculate timing i got even more confused with the following:&lt;/p&gt;
&lt;p&gt;those two statement take 200-300ms to execute after an&amp;nbsp;ListchangeType.ItemAdded/ItemDeleted but around 4000-10000ms after a ListChangeType.ItemMoved&lt;/p&gt;
&lt;p&gt;Me.Subtotal(C1.Win.C1FlexGrid.AggregateEnum.Clear)&lt;br /&gt;Me.Subtotal(C1.Win.C1FlexGrid.AggregateEnum.None, 0, 1, 0, &amp;quot;{0}&amp;quot;)&lt;/p&gt;
&lt;p&gt;Any idea why itemMoved can be different? is there any thing that might be fired on an item moved that makes the above two statement exponentinally slower?&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Grid Unusable with one column Subtotal</title><link>http://helpcentral.componentone.com/CS/thread/228048.aspx</link><pubDate>Thu, 28 Jan 2010 19:35:22 GMT</pubDate><guid isPermaLink="false">6ffc9ae0-0270-4839-b826-46696419445e:228048</guid><dc:creator>assassin316</dc:creator><description>&lt;p&gt;Scenario:&lt;/p&gt;
&lt;p&gt;- Grid bound to a dataview with 20000 entries, sorted on a Street Column.&lt;/p&gt;
&lt;p&gt;-Each Row has around 20 columns,&amp;nbsp;customer information, each customer has a &amp;quot;street&amp;quot; column, we group customers by &amp;quot;street&amp;quot;&amp;nbsp;column (a simple string).&lt;/p&gt;
&lt;p&gt;-With the above the grouping will give roughly around 10000-120000 Node (many distinct streets)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;The problem is the following: Customer data (ie the underline datatable bound to the grid) recieve changes from the network, ie customer are added, customer deleted, or customer have their streets&amp;nbsp;attribute changed. When this happens, the grid nodes do not update correctly (i am grouping with &lt;font size="2"&gt;C1.Win.C1FlexGrid.AggregateEnum.None), ie if a customer with new address is added, the new address node is not added automatically, if an existing customer is deleted and is the last in a street node, the node does not get deleted, if an exisitng customer address is changed to some new address, again the node is not created or if it was the last in the node the node is not deleted it even does not move to the right node. To fix all of the above, the simple code was added which cover all the cases:&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;Private Sub Grid_DataChanged(ByVal sender As Object, ByVal e As ListChangedEventArgs) Handles Me.AfterDataRefresh&lt;/p&gt;
&lt;p&gt;If e.ListChangedType = ListChangedType.Reset Then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39;Recalculate Groups&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me.Subtotal(C1.Win.C1FlexGrid.AggregateEnum.Clear)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me.Subtotal(C1.Win.C1FlexGrid.AggregateEnum.None, 0, 1, 0, &amp;quot;{0}&amp;quot;)&lt;br /&gt;ElseIf e.ListChangedType = ListChangedType.ItemAdded Then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39;Recalculate Groups&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me.Subtotal(C1.Win.C1FlexGrid.AggregateEnum.Clear)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me.Subtotal(C1.Win.C1FlexGrid.AggregateEnum.None, 0, 1, 0, &amp;quot;{0}&amp;quot;)&lt;br /&gt;ElseIf e.ListChangedType = ListChangedType.ItemDeleted Then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39;Recalculate Groups&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me.Subtotal(C1.Win.C1FlexGrid.AggregateEnum.Clear)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me.Subtotal(C1.Win.C1FlexGrid.AggregateEnum.None, 0, 1, 0, &amp;quot;{0}&amp;quot;)&lt;br /&gt;ElseIf e.ListChangedType = ListChangedType.ItemChanged Then&lt;br /&gt;&amp;nbsp;&amp;nbsp; If e.PropertyDescriptor.Name=&amp;quot;customer address&amp;quot; Then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39;Recalculate Groups&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me.Subtotal(C1.Win.C1FlexGrid.AggregateEnum.Clear)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me.Subtotal(C1.Win.C1FlexGrid.AggregateEnum.None, 0, 1, 0, &amp;quot;{0}&amp;quot;)&lt;br /&gt;&amp;nbsp;&amp;nbsp; End If&lt;br /&gt;ElseIf e.ListChangedType = ListChangedType.ItemMoved Then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39;Recalculate Groups&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me.Subtotal(C1.Win.C1FlexGrid.AggregateEnum.Clear)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me.Subtotal(C1.Win.C1FlexGrid.AggregateEnum.None, 0, 1, 0, &amp;quot;{0}&amp;quot;)&lt;br /&gt;End If&lt;/p&gt;
&lt;p&gt;End Sub&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;The above event does the trick and handles all the cases, however, it will be extremely slow, subtotaling the above takes around 5 sec, having to subtotal on each customer addition.deletion/street changes takes 5 sec each time and is causing sporadic freezes in the applications.&lt;/p&gt;
&lt;p&gt;Is there a better way to do the above? &lt;strong&gt;&lt;u&gt;Basically we need the nodes to be correctly updated with the grid updates&lt;/u&gt;&lt;/strong&gt;. I am pretty sure many people NEED that too, it is just overkill to do the subtotal on each change.&lt;/p&gt;
&lt;p&gt;PS1: The worst in the above is when a customer is added/deleted as this can happen a LOT and triggers a subtotal. Whats worse is a customer will be added with no street then assigned a street triggering two subtotal calculation. Also each subtotal clearing and calculation is surrounded by Grid.redraw=false/true.&lt;/p&gt;
&lt;p&gt;Any Help is appreciated.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>