Hello,
I am using Outsystems data grid, where I am using a structure with more that 50 attributes to bind data with grid.
In attributes which has properties like Name, Description, Label. I want to set the Name property of the attribute because data grid puts Name property as the column header in an auto generated data grid.
Auto generated grids takes attribute name as column header, and I cant add spaces in the name tag of attribute.
The grid column header looks like this, without spaces. I don't want to use Outsystems data grid Text columns block, as we have too many attribute defined in the structure, so adding columns for every attribute is not gone help me. Please let me know if there is any other way to add columns header, for the auto generated data grid.
Hello @Keshav Raghav
To achieve that you should add a formatItem handler to your grid, using the initialize event from the Grid block.
As a practical example, here's a scenario where I'm setting the header according to the binding, which is what I would advice:
Cheers,GM
Can we use loop instead of switch case here.? As we have too many columns in our grid, adding switch case will increase no of lines in javascript code.
This was an example showcasing the functionality. You should implement it according to your use cases and needs.
Hi,
Can you check "WhyColumn" page in Datagrid sample app.
https://wasim.outsystemscloud.com/OutSystemsDataGridSample/WhyColumns
You can rename the column.
Regards,
Wasimkhan S
I think it uses TextColumn block from data grid. I cannot use this block to customize columns, as if we go with this approach, we will end up using too many TextColumn blocks.
Yes. I think this the way to change the column.
Regards,Wasimkhan S
Well, I don't think there's any other way to change the headers apart from changing them manually in the properties or autogenerating them after creating a customised structure with the Headers as you need.
@Keshav Raghav