FlexGrid Rows Count change in behaviour

Posted by: rafael.riveratorres on 23 August 2024, 6:53 am EST

  • Posted 23 August 2024, 6:53 am EST - Updated 23 August 2024, 9:41 am EST

    We were upgrading the version of our C1 nuggets from 8.0.20233.631 to the latest 8.0.20241.664.

    Then we started having several crashes in our apps due to the fact that in many cases the grids .Rows.Count() calls were returning a different value than before; +1 to be precise. Our suspicion is that the latest version of Flexgrid considers the footer of the grid for the Get/Set of the Rows.Count; a behaviour that was not present in the previous version.

    I attach to this case a sample project, where according to the version of Flexgrid the header of the grid dissapears as the Rows.Count (the Setter in this case) behaves different.

  • Posted 26 August 2024, 1:04 am EST

    Hello,

    Apologies but did not find your sample attached in the ticket. (If the size of sample is large, please delete the bin, obj and packages folders from the project; zip it and try attaching again.)

    We tried to replicate the behavior by adding a footer to FlexGrid and checking the Rows.Count’s value in both 631 and 664 builds. The result was the same, thus we were unable to replicate the behavior.

    Could you please update the attached sample or try attaching your stripped-down sample, so that we can observe and investigate the behavior on our end?

    Sample: FlexGrid_RowCount.zip

    Regards,

    Uttkarsh.

  • Posted 26 August 2024, 2:44 am EST

    Sample caseShowcase.zip

  • Posted 27 August 2024, 12:17 am EST

    Hello,

    Thank you for sharing the sample. We were able to replicate the behavior on our end. We have escalated it to the developers for further insights and will keep you updated with the necessary information.

    [Internal Tracking ID: C1WIN-32840]

    Regards,

    Uttkarsh.

  • Posted 29 August 2024, 12:27 am EST

    Hello,

    As per the development team, the reported behavior is by design. The following changes have been implemented by the developers:

    • When deleting, regular rows have a higher priority than footers, i.e., deleting order is: normal rows → fixed rows → footer rows.
    • Rows.Count now returns the number of regular rows with footers together.

    As per the development team, the Rows.Count is supposed to display the total number of rows in the FlexGrid, including the footers.

    For example, if we have 1 fixed row and 2 footer rows, then we assign 10 rows for the Rows.Count property. It should lead to 1 fixed row, 2 footer rows, and 7 regular rows. However, if the Rows.Count is less than the total of fixed and footer rows, then the extra rows are deleted as per the “deleting order” as mentioned above.

    Regards,

    Uttkarsh.

  • Posted 29 August 2024, 2:40 am EST

    Hi,

    Thanks for your reply.

    In conclusion, which would be the solution to the problems we are having? In our apps we used extensively the Rows.Count method to handle multiple operations and validations over the rows; and this change in paradigm of how the Rows.Count now considers the footer has a huge impact on the expected behaviour. Are we really being forced to change every single piece of code that uses the Rows.Count to adapt to this change? Is there any flag somewhere to disable this new behaviour and use the old one by default?

    Best regards,

    Rafael Rivera

  • Posted 30 August 2024, 1:43 am EST

    Hello Rafael,

    We understand your concerns and sincerely apologize for the inconvenience caused to you. The older behavior was a design issue, and fixing it caused the breaking change in FlexGrid.

    To get the older functionality back, you can simply use the following check condition wherever you set the Rows.Count property:

    var fixedAndFooters = grid.Rows.Fixed + grid.Footers.Descriptions.Count;
    grid.Rows.Count = value < fixedAndFooters ? fixedAndFooters : value;


    Where “value” is the value your are setting to Rows.Count.

    OR

    You can create a custom grid inheriting FlexGrid with RowsCount property having the above logic in its setter and use RowsCount property instead of Rows.Count.

    Please refer to the attached modified sample for implementation and let us know if it helps. (see Showcase.zip)

    Regards,

    Uttkarsh.

Need extra support?

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

Learn More

Forum Channels