grids group
ManStruggling opened this issue · 15 comments
When we want to group value columns of an enumeration type,the value of the grouped column is not formatted?column.Enablegroupbyformat has been set to true
The version is 18.xx.xx
Hi @ManStruggling,
Greetings from Syncfusion
By default the EJ2 Grid columns support only the following data types,
• string
• number
• boolean
• date
• datetime
Please find the below documentation for reference,
https://ej2.syncfusion.com/javascript/documentation/grid/columns/#column-type
And currently the EJ2 Grid doesn’t have support to bind Enum type data in the Grid columns.
Let us know if you have any concerns.
Regards,
Sujith R
Hi @ManStruggling,
Based on the provided information we could understand that you are facing the problem with string type column but we are not clear on what formatting you have applied there(since columns format property is used for date and number type columns). So please share us the following information to validate further on this,
- By formatting are you mentioning cell values modified using column template or value accessor? If not, then please elaborate on your exact use case.
- Share us the Grid code file.
- Share us pictorial or video demonstration of the problem for better understanding.
Regards,
Sujith R
Hi @ManStruggling,
Based on the shared sample, we could see that you have enabled the ‘enableGroupByFormat’ property, formatted the column values using ‘formatter’ property and want to display the formatted value in group caption. We would like to let you know that the ‘enableGroupByFormat’ property is used for grouping numeric or datetime column based on the mentioned format and the ‘formatter’ property is used for formatting all available column type cell values. So the formatted value will not be displayed but the column field value will be shown on group caption which is its default behavior.
More details on the group by format can be checked in the below documentation link,
Documentation: https://ej2.syncfusion.com/vue/documentation/grid/grouping/#group-by-format
However you can achieve your requirement of customizing the group caption text by using the groupSettings captionTemplate property. With this you can check and return the group caption text to be displayed by checking required condition.
This is demonstrated in the below code snippet for your case,
`<script>
import Vue from "vue";
export default {
data: function () {
return {
groupOptions: { captionTemplate: function() {
return {
template: Vue.component("columnTemplate", {
template: <div>{{captionValue}}</div>,
data: function() {
return {
data: {}
};
},
computed: {
// Returned value will be bound to the group cation
captionValue: function(value) {
if (value.data.field === "Country") {
// Executes for the 'Country' field column alone
var s = (value.data.key === "Australia") ? "Aus" : "Other"
return s;
} else {
// For the remaining columns, the key value is directly returned
return value.data.key;
}
}
}
})
};
}
},
}
}
</script>`
We have modified the GitHub sample based on this for your reference. You can find it below,
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/GridUpdated-420542799
More details on this can be checked in the below documentation link,
Documentation: https://ej2.syncfusion.com/react/documentation/grid/grouping/#caption-template
Let us know if you have any concerns.
Regards,
Sujith R
Hi @ManStruggling,
Based on the shared sample we would like to let you know the following information,
-
The Grid actions like, Grouping, Filtering, etc., works on basis of the underlying data source value. The formatter property is only used for modifying the display value in the UI level and the grouping action will be performed on the column data field value.
-
The date column values present in the Grid’s data source need to be in Date object format as the date column operations(like, Grouping, Filtering, etc.) are done on the basis of date objects in the source-level. This is the Grid’s default behavior. So, please provide the date values in Date object format instead of string to resolve the problem.
We have modified the GitHub sample from the shared repository based on this for your reference. You can find it below,
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/GridModified43694617
Documentation: https://ej2.syncfusion.com/vue/documentation/grid/columns/#date-formatting
Let us know if you have any concerns.
Regards,
Sujith R
Hi @ManStruggling,
You’re welcome.
As for this query – “if there is a need to do group processing for the results of string supporting format, it seems that it is not supported at present.”, we suspect that your requirement is to customize the string format values that are displayed in the Grid. You can achieve this by using the value accessor functionality of the Grid which allows to customize the display data. More details on this can be checked in the below documentation link,
Documentation: https://ej2.syncfusion.com/vue/documentation/grid/columns/#valueaccessor
If we misunderstood your query or if you require any further assistance, then please get back to us.
Regards,
Sujith R
Hi @ManStruggling,
We are still not able to clearly understand your query from the provided information, so please confirm us the following details to validate further on this,
• Is your reported problem that when providing the date type columns as string format it needs to be formatted based on date format? If so, as mentioned in our previous response please provide the date columns values in date object format in the Grid’s dataSource as the Grid actions will be performed based on date object for it.
• By attachment we suspect you mean the GitHub sample repository that you had shared. If so, we could see that you are just formatting the string values to date and displaying it in the Grid column using ‘formatter’ property. As mentioned above, the date columns values need to be provided as date object in the Grid data source itself. So please provide it in the mentioned format to resolve the problem.
If we misunderstood your query or if you need to share us additional information, then please share us the same based on which we will check and provide the further details.
Regards,
Sujith R
We have closed this pull request now, since there's no recent activities. You can reopen this issue if you have any queries.