JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › Data Grid › DisplayField not working
- This topic has 9 replies, 2 voices, and was last updated 1 year, 7 months ago by oliver.aldrian.
-
AuthorPosts
-
April 25, 2023 at 12:57 pm #104758oliver.aldrianParticipant
Hi,
DisplayField is ignored in Blazor.
See Reproduction in https://github.com/DiawaKG/reproduction-smarthtml-grid-displayfield-not-working
Thanks,
KR
April 25, 2023 at 3:18 pm #104765adminKeymasterAs a workaround, you can create a column which is hidden and has its DataField = DisplayName
April 25, 2023 at 3:36 pm #104766oliver.aldrianParticipantthe reproduction of the problem is not my use case, so that workaround won’t work for me.
my displayed data in the grid contains an object of a complex type, which needs to be set in the grid.
So I have a autocomplete editor which displays the different options to select from, and when selected I handle the assignment in the CellEndEdit event
I have following properties set up
ComplexObject ObjectLink {get set} string ObjectLinkName => ObjectLink?.ToString() string ObjectLinkSetter {get set}
and my grid column
<div> <div><Column DataField="ObjectLinkSetter" DisplayField="ObjectLinkName" Label="blah" AllowEdit="true" Editor="@autocompleteEditor" /></div> </div>
I cannot use the ObjectLink directly, or at least the grid didn’t like it at all.
April 25, 2023 at 3:38 pm #104767oliver.aldrianParticipantand yes I know I could go change my complete backend to have the ObjectLinkName “dereferenced” and saved alongside. but why would I… this is clearly a bug
April 25, 2023 at 3:42 pm #104768adminKeymasterWe offered a workaround. A fix will come in a future version.
April 25, 2023 at 5:29 pm #104769oliver.aldrianParticipantyou offered a workaround for a use case that does not exist… but ok….
do you have a timeframe for the fix, so I can communicate that to my customer?
KR
April 27, 2023 at 7:39 am #104789adminKeymasterHi Oliver,
The workaround is valid for any use case. Adding a hidden column is possible in any app using a Grid.
Regards,
PeterApril 27, 2023 at 7:47 am #104790oliver.aldrianParticipantHow is the workaround viable If I want to use the DisplayField parameter do actually display something?
I dont need the column hidden, I need it displayed…
My DisplayName is an auto property that is filled from a complex datatype
I literally cannot Set anything to it.
I want to use the DisplayField and DataField together in one visible column, that uses an autocomplete editor, to use the value from the AutoComplete editor in the EndEdit Event to calculate the fitting ComplexObject and set it in my datamodel, which then fills the auto property which is displayed.
How would a hidden column with a displayField help in this case??
April 27, 2023 at 8:46 am #104791adminKeymasterHi Oliver,
Create a Hidden Column with dataField = your Display Field and your column with the Display Field will work
Regards,
PeterApril 27, 2023 at 9:09 am #104792oliver.aldrianParticipantAh I see… the DisplayField Property is not loaded to the grid correctly, and with having it a DataField somewhere the Property is forced to be loaded on the DataGrid.
If you would have said that that was the problem I would not have had complained.
Thanks
-
AuthorPosts
- You must be logged in to reply to this topic.