Values not displaying for certain column names in Grid

1 Answer 67 Views
GridView
M.
Top achievements
Rank 1
M. asked on 04 Aug 2023, 12:59 PM | edited on 04 Aug 2023, 01:00 PM

Hi,
When using certain column names in a Telerik WPF grid, the corresponding values are not being displayed correctly. The issue occurs when attempting to show data in the grid with the following column names :

Data = new ObservableCollection<CustomDynamicObject>()
        {
            new CustomDynamicObject(new Dictionary<string, object>
            {
                {"Check bug", "OK"}, // Values displayed correctly
                {"Check. bug.", "OK"}, // Values not displayed correctly
                {"Check. bug", "OK"}, // Values not displayed correctly
                {"Check.", "OK"}, // Values not displayed correctly
                {"Check ", "OK"}, // Values not displayed correctly
                {"Check bug.", "OK"}, // Values displayed correctly
                {"Check bug ", "OK"}, // Values displayed correctly
            })
        };
<telerik:RadGridView ItemsSource="{Binding Data}"/>

(CustomDynamicObject is a custom class that implements DynamicObject with Dictionary<string, object>())

Expected Behavior :

The values for each column name mentioned above should be displayed correctly in the Telerik WPF grid. Users should be able to see the data without any missing or truncated values.

Observed Behavior :

After binding the data object to the grid, some values are not visible for specific column names. This issue appears to be related to column names that contain special characters such as periods (".") and spaces. Consequently, users cannot view the complete dataset, leading to data misinterpretation.

Example

Additional Notes:

This issue severely impacts the usability of our application, as users rely on the accurate display of data in the grid. We use dynamic objects because the user generates the SQL requests. Is it a bug? There is any workaround or alternative approach using dynamic objects that would allow us to display the data correctly in the grid, we would be grateful for your guidance on implementing it ?

Attached you'll find a simplified example of how to reproduce the bug and a screenshot.

If you require any additional information or assistance in reproducing the bug, please do not hesitate to reach out. We are eager to see this issue addressed as soon as possible.

Best regards,

1 Answer, 1 is accepted

Sort by
0
Accepted
Dimitar
Telerik team
answered on 07 Aug 2023, 11:37 AM

Hello Sylvain,

In this case, the values cannot contain dots or spaces since they are tokenized (separated by spaces or dots, in addition, the values are trimmed). The tokenized values are used for the binding of the columns and cannot contain these characters unless you intentionally want to use subproperties. I would suggest avoiding these symbols in this case. If this is not possible I can recommend checking the VirtualGrid (it has some limitations) or perhaps changing how this is handled in our source code (which is an advanced solution).  

I hope this helps. Should you have any other questions do not hesitate to ask.

Regards,
Dimitar
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

M.
Top achievements
Rank 1
commented on 08 Aug 2023, 10:53 AM | edited

Many thanks for your help, it allowed us to better identify the source of the problem.
We fixed the problem by using the OnAutoGeneratingColumn event and specifying the binding we wanted.
There's just the case of spacing at the end, which isn't dealt with. But that's not a problem if we're going to trim user input. But we could manage the case with a customized Binding.
    private void GridViewDataControl_OnAutoGeneratingColumn(object? sender, GridViewAutoGeneratingColumnEventArgs e)
    {
        ((GridViewDataColumn)e.Column).DataMemberBinding = new Binding($"[{e.Column.UniqueName}]");
    }
Tags
GridView
Asked by
M.
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or