AddItem() adds two rows to FlexGrid instead of one

Posted by: AnthonyC on 19 October 2017, 2:25 am EST

    • Post Options:
    • Link

    Posted 19 October 2017, 2:25 am EST

    We are having an issue with the AddItem() method that is causing an exception to be thrown in our project. If we load data into a flex grid, edit one of the rows, press enter, then clear the data and call the AddItem() method, it will add two rows instead of one. However, if you don’t edit any of the rows before clearing the data, it will add one row like we expect it to. I’ve attached a sample project that will demonstrate this behavior.

  • Posted 19 October 2017, 2:25 am EST

    I guess the file didn’t attach. Here it is.

    C1FlexGridAddItemIssue.zip

  • Posted 22 October 2017, 9:09 pm EST

    Hi Anthony,

    Thanks a lot for sharing the sample application.

    However, could you elaborate a bit about how you are clearing the data, once the data is loaded in C1FlexGrid, since there are only Add Row, Undo and LoadData options available in your application UI.

    And loading data in grid, editing any row, pressing enter and Adding a new row does not create multiple rows at our end. So, could you please share your build version you are using?

    Thanks,

    Ruchir Agarwal

  • Posted 23 October 2017, 2:55 am EST

    I’ve attached a short video demonstrating the behavior. It’s a little easier than explaining. If you have more questions afterwards, I will do my best to explain.

    C1FlexGridAddItemIssue.zip

  • Posted 23 October 2017, 3:06 am EST

    And I’m using version 4.0.20172.271, Runtime Version 4.0.30319 of the FlexGrid assembly.

  • Posted 23 October 2017, 6:17 pm EST

    Hi,

    Thank you for attaching a video showing the issue.

    We could observe the same at our end and it is an issue with the control. Hence the same has been escalated to the Development team for fix {Tracking ID: 293038}.

    We would update you once it is fixed.

    Regards,

    Ruchir Agarwal

  • Posted 24 October 2017, 1:26 am EST

    You’re welcome. Awesome, thank you for your help!

  • Posted 24 October 2017, 11:19 pm EST

    Hi,

    For meantime, you can modify your AddRow() method as:

     
                   private void AddRow()
            {
                C1FlexGrid g = _dataGrid;
                if ((g.DataSource as DataTable) == null)
                {
                    g.AddItem("");
                }
                else
                {
                    (g.DataSource as DataTable).Rows.Add((g.DataSource as DataTable).NewRow());
                }            
            }
    
    

    Hope, it will help you.

    Thanks,

    Singh

  • Posted 25 October 2017, 1:50 am EST

    Hello,

    It helped with the sample application, but unfortunately not in the production code. I will wait for the update.

    Thank you!

  • Posted 22 January 2018, 10:14 pm EST

    Hi,

    The issue has been fixed in the latest hotfix which can be downloaded from the below mentioned link:

    http://prerelease.componentone.com/hotfixes/dotnet/C1WinForms.4_4.0.20173.291.zip

    Best Regards,

    Esha

  • Posted 23 January 2018, 3:24 am EST

    Hello Esha,

    I will try it and let you know how it goes. Thank you!

Need extra support?

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

Learn More

Forum Channels