TrueDBGrid custom editor deletes newly created row

Posted by: marc.brown on 31 January 2019, 12:45 pm EST

    • Post Options:
    • Link

    Posted 31 January 2019, 12:45 pm EST

    I’m working with a data-bound TrueDBGrid. The row data comes from a class we created. One of the members of this class is a mailing address (which is a class with four string properties). I created a custom editor containing 4 text boxes in a panel (extending UserControl and implementing IC1EmbeddedEditor).

    For existing rows in the grid, clicking on the mailing address cell opens the editor, allows me to make changes, then passes the change back to the object represented by the row in the grid. In other words, it works as expected.

    However, creating a new row in the grid doesn’t work properly (it worked properly before moving from individual properties/columns for the four mailing address lines). Instead, when I click on the mailing address cell in the “*” row, it creates a row and opens the custom editor. It allows me to make changes. But when the custom editor closes, the new row is removed and the new object is removed from the underlying list.

    If, instead of starting with the mailing address, I start with a different column that doesn’t have a custom editor, the new row will stay around until I attempt to edit the mailing address at which point it is removed after editing.

    I can only manage to keep the new row if I start by editing a column other than mailing address, then move to a different row, then move back to the row I created.

    Any pointers would be appreciated.

  • Posted 1 February 2019, 7:37 am EST

    Hello Marc,

    In my understanding, this issue occurs because of no value passed to the newly created row cell through use Control after leaving the cell. Could you please make sure the content is passed from use control to row on after moving to another cell. You can observe the same behavior with the other cells. Just double click on the cell of “*” row and after that click any cell of above rows. You can observe newly created row is disappeared.

    Also, “IC1EmbeddedEditor” is a part of C1FlexGrid, not a C1TruDBGrid. Is there any specific reason to use “IC1EmbeddedEditor” in C1TruDBGrid.

    Thanks.

  • Posted 1 February 2019, 1:03 pm EST - Updated 4 October 2022, 1:27 am EST

    Indeed the behavior is the same as if no value was being passed back. I’m passing the object back to the grid via implementation of the IC1EmbeddedEditor method C1EditorGetValue(). That method is being hit (I set a breakpoint in that method to be sure). So it would appear that the grid isn’t paying attention to the return value or something.

    In answer to your question about why I’m using IC1EmbeddedEditor – I realize it’s part of C1FlexGrid; however, the documentation for C1TrueDBGrid says to use it (https://help.grapecity.com/componentone/NetHelp/c1truedbgrid/webframe.html#usingcustomeditors.html) and the grid does call the implemented methods as expected.

    I’m baffled at this point because it looks like it should work but doesn’t. Unfortunately, the samples provided with the product haven’t been helpful because they’re fairly simple (which isn’t a criticism – they’re there to get you started, not show every scenario). Again, any suggestions would be appreciated. If it would be better not to implement IC1EmbeddedEditor, how should I go about getting the value from the grid to the control and putting the updated/new value back into the grid from the control?

  • Posted 4 February 2019, 7:33 am EST

    Hello,

    I am able to replicate the issue at my end. I have escalated the issue to our development team(365681) and will inform you once I get any information from them.

    Thanks.

  • Posted 7 February 2019, 2:48 am EST

    Hello,

    Thanks for your patience.

    We have created the sample for you to use IC1EmbeddedEditor in C1TrueDBGrid, Please refer to the attached sample.

    If the problem still occurs, please feel free to revert.

    Thanks.

    C1TrueDBGrid_IC1EmbeddedEditor_workaround (2).zip

  • Posted 7 February 2019, 11:39 am EST

    Thanks so much! I was able to make mine work based on what your sample did.

Need extra support?

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

Learn More

Forum Channels