Fix subtotal row

Posted by: lolivier on 27 September 2017, 9:07 pm EST

  • Posted 27 September 2017, 9:07 pm EST

    Hello,

    Is it possible to do a belowdata subtotal row and fixes it ?

    I’ve a grid with a lot of row and i want to always see the subtotal row. Not only when i am on the bottom on the grid.

    Moreover, I’ve made this :

    _flex.Subtotal(AggregateEnum.Sum, -1, -1, index, “Grand Total”);

    but i don’t know how to display “grand total” in my grid. I’ve only empty cell before total.

  • Posted 27 September 2017, 9:07 pm EST

    Hi,

    Please note, you cannot achieve your requirement(s) using C1FlexGrid to fix a sub total row.

    You can just set its position to AboveData or BelowData as:

    [csharp]c1FlexGrid1.SubtotalPosition = C1.Win.C1FlexGrid.SubtotalPositionEnum.BelowData; [/csharp]

    Hope, it clarifies.

    Thanks,

    Sonu

  • Posted 27 September 2017, 9:07 pm EST

    Hello Lolivier,

    I think there is a workaround that can be used to freeze the subtotal row at the bottom. What you can do is use a control (like panel) that contains a C1FlexGrid. The contained C1FlexGrid should be positioned with a negative Y coordinate within the panel so that fixed rows are not visible. And the whole set (panel and C1FlexGrid) can be attached to main C1FlexGrid and positioned at its bottom.

    For implementation, please refer to the attached sample application.

    And for information regarding implementing “GrandTotal”, please refer to following documentation links:

    http://our.componentone.com/samples/winforms-subtotals/

    http://helpcentral.componentone.com/nethelp/c1flexgrid/topic25.html

    Hope this helps you.

    Thanks,

    Pragati

    2016/11/FreezeBottom.zip

  • Posted 27 September 2017, 9:07 pm EST

    Hello Pragati Kaushik,

    Great sample,very useful !!

    but i’ve a small problem.

    it doesn’t take my filter and i don’t know why

    [csharp]

    flex.Cols[“ETAT”].Filter = null;

    flex.Cols[“SOMCONCENTRE”].Filter = null;

            if (rbConcentre.Checked == true)
            {
                var f = new C1.Win.C1FlexGrid.ColumnFilter();
                var c1 = f.ConditionFilter.Condition1;
                c1.Parameter = 0;
                c1.Operator = C1.Win.C1FlexGrid.ConditionOperator.NotEquals;
                flex.Cols["SOMCONCENTRE"].Filter = f;
            }
    
            if (rbHorsPCG.Checked == true)
            {
                var f4 = new C1.Win.C1FlexGrid.ColumnFilter();
                var c4 = f4.ConditionFilter.Condition1;
                c4.Parameter = string.Empty;
                c4.Operator = C1.Win.C1FlexGrid.ConditionOperator.NotEquals;
    
                flex.Cols["ETAT"].Filter = f4;
    
            }
    
            List LstCol = new List();
            LstCol.Add(1);
            LstCol.Add(5);
            
    
            
            FlexFreezeBottom ffb = new FlexFreezeBottom(flex, 1, LstCol);[/csharp]
    

    here, the update,I've made :

    [csharp] main.SubtotalPosition = SubtotalPositionEnum.BelowData;

    foreach (int index in LstIndexSum)

    {

    main.Subtotal(AggregateEnum.Sum, 1, -1, index, "Total{0}");

    }[/csharp]

    any idea?

    thanks

  • Posted 27 September 2017, 9:07 pm EST

    I’ve found a solution.

    before call :

    [csharp]FlexFreezeBottom ffb = new FlexFreezeBottom(flex, 1, LstCol);[/csharp]

    I’ve added :

    [csharp]flex.ApplyFilters();[/csharp]

    I’ve only a refresh problem : We see the grid to redraw.

  • Posted 27 September 2017, 9:07 pm EST

    Hello Lolivier,

    Great that you found the sample useful and that you could solve the filter problem. However, could you please elaborate more about when are you facing the refresh problem?

    Following are some standard methods of solving such issues.

    1.Try using BeginUpdate and EndUpdate methods of C1FlexGrid.

    2.You can also try setting flex.redraw = False before performing filtering and flex.redraw=True after you have applied filtering.

    If the problem still persists, would request you to please share a video demonstrating the problem along with a stripped down application showing how you implemented the filter, which is causing the issue.

    Thanks,

    Pragati

  • Posted 27 September 2017, 9:07 pm EST

    • it’s only a temporary white rectangle in the top left on the grid.

    • I don’t know how to display “Total{0}”

      I’ve spent a lot of time and i don’t understand.

      [csharp] main.SubtotalPosition = SubtotalPositionEnum.BelowData;

      foreach (int index in LstIndexSum)

      {

      main.Subtotal(AggregateEnum.Sum, -1, -1, index, “Total{0}”);

      }[/csharp]

  • Posted 27 September 2017, 9:07 pm EST

    hi,

    I have to modify my grid datasource.

    but my grid make wierd things ( cf picture)

    2016/11/test.gif

  • Posted 27 September 2017, 9:07 pm EST

    Hi Lolivier,

    I could not find any attachment uploaded with your last post, the link appears to be broken.

    Therefore, would request you to please share it again and also share a screenshot showing the top left white box that is appearing in your C1FlexGrid.

    Regarding the Total{}, please try setting the Tree.Column property to the index of the column where you want the Total to be written. That’s the column where the outline tree and titles are displayed.

    You may also want to go through the following documentation links which provide useful information on “Using the Subtotal method”:

    http://our.componentone.com/samples/winforms-subtotals/

    http://helpcentral.componentone.com/nethelp/c1flexgrid/topic25.html

    If the problem still persists, would request you to please elaborate more on how you do you want the subtotal to show.

    Regards,

    Pragati

  • Posted 6 August 2019, 9:19 am EST

    Please call UpdateSubtotal function in after filter event of FlexGrid like below:

    private void fgStatus_AfterFilter(object sender, EventArgs e)

    {

    UpdateTotals();

    }

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels