C1 FlexGrid, computed columns, and copy/paste

Posted by: egor.kachiguine on 31 October 2018, 6:21 am EST

    • Post Options:
    • Link

    Posted 31 October 2018, 6:21 am EST

    So, basically, I have some computed columns, using a binding on the row data item, and a value converter.

    <c1:Column Header="Security Qty" HeaderTextWrapping="True" Width="75" IsReadOnly="True" HeaderHorizontalAlignment="Center"  
                               Binding="{Binding Converter={StaticResource ICashItemQuantityConverter}, StringFormat='###,##0.00;;#'}"
                               DataType="{x:Type system:Double}"
                               HorizontalAlignment="Right" GroupAggregate="Custom"/>
    

    It works just fine on screen - but when I try to copy the row to excel, the values on the computed columns are being replaced with the parent object .ToString() implementation.

    I’m not using a custom template or anything, but the documentation says that even if you are, the column binding is provided solely for copy/paste, sorting, etc functionality. Is there any obvious reason why copy/paste isn’t picking up the value converter?

  • Posted 31 October 2018, 11:32 pm EST

    Hello,

    I am not sure about how are you are computing the columns and the structure of your application, so could you please share some demo application to replicate the issue?

    Thanks,

    Ruchir

  • Posted 1 November 2018, 4:42 am EST

    I could try and replicate this issue in a demo project, but long story short - I’m “faking” a property on the object using a value converter in the column binding. It works just fine on the display side of things, but the valueconverter is simply ignored on copy/paste.

    Not using templates, etc.

    Before I start to put together a demo project, is this even a supported use case?

    Our next release uses a “thin” viewmodel that fills in those missing properties without using value converters, and everything works just fine there. I was wondering if there was something I was obviously missing, or if there is a separate copy/paste binding, etc. If I have to manually intercept and massage copy/paste output, the effort might not be worth it just for a patch.

    Using FlexGrid version 4.0.20182.595.

  • Posted 1 November 2018, 11:01 pm EST

    Hello,

    Thank you for elaborating.

    I guess I now understand the issue. As per my understanding, you are modifying the values of a property (using Converter) and showing these computed values in a column. Now, while doing so though the computed values appear/display fine in grid, they do not get pasted correctly. When pasting the values are the original values not the computed ones. Is this the issue?

    If this is the issue then I would like to inform you that I am able observe it at my end by showing the computed values using CellFactory’s CreateCellContent method. However, to resolve this issue you just need to apply Converter to the column without using CellFactory.

    *If you run the attached sample and copy paste a row in Excel, observe that the values pasted for ‘Rating’ column is computed value whereas value pasted for ‘Name’ column is original value.

    However, if this is not your issue and all this does not make any sense, I request you to kindly modify the attached sample for us to replicate.

    Thanks,

    Ruchir

    Converter_C1FlexGrid.zip

  • Posted 21 November 2018, 4:38 am EST

    I just wanted to say that this approached worked for me in a pinch - thank you.

Need extra support?

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

Learn More

Forum Channels