FFREDIANELLI Posted December 2, 2022 Share Posted December 2, 2022 hI, I need to group a grid by a detetime field, my problem is that even with display format on datasource set to DD/MM/YYYY it shows in GMT format, how can i set this ? Best Regards Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 2, 2022 Share Posted December 2, 2022 5 hours ago, FFREDIANELLI said: I need to group a grid by a detetime field, my problem is that even with display format on datasource set to DD/MM/YYYY it shows in GMT format, how can i set this ? Hello, What code are you using? Quote Link to comment Share on other sites More sharing options...
FFREDIANELLI Posted December 4, 2022 Author Share Posted December 4, 2022 Hi Sherzod No code involved, i just enabled grouping , summary and show value, the title i let the name of the field..., iin the dbgrid, and thats it... it shows the header of grouping followed by the date correclty , but the format not follow the datasource display format , and i do not find any display format in this grouping opptions, it shows in gmt format... Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 4, 2022 Share Posted December 4, 2022 4 hours ago, FFREDIANELLI said: No code involved, i just enabled grouping , summary and show value, the title i let the name of the field..., iin the dbgrid, and thats it... it shows the header of grouping followed by the date correclty , but the format not follow the datasource display format , and i do not find any display format in this grouping opptions, it shows in gmt format... Ok. Try searching the forum with the keyword "groupheadertpl". Quote Link to comment Share on other sites More sharing options...
FFREDIANELLI Posted December 21, 2022 Author Share Posted December 21, 2022 ok, there are some examples to show how to put qtd of items in the group header, some text explaining the group, but none of how to show a date header in DD/MM/YYYY i found this javascript function function format(inputDate) { let date, month, year; date = inputDate.getDate(); month = inputDate.getMonth() + 1; year = inputDate.getFullYear(); date = date .toString() .padStart(2, '0'); month = month .toString() .padStart(2, '0'); return `${date}/${month}/${year}`; } but how to adapt this function , that now show the qtd items (cool) but with the date in DD/MM/YYYY format ? function beforeInit(sender, config) { sender.disableSelection = true; var groupingFeature = Ext.create('Ext.grid.feature.Grouping', { groupHeaderTpl: new Ext.XTemplate( '{columnName}: {name} ({[this.countTotal(values.rows)]})', '', { countTotal: function(records) { var totalSum = 0; totalSum = records.length; return totalSum; } } ), hideGroupedHeader: true }); config.features = [groupingFeature] } Some help will be appreciated , thenks in advance. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 21, 2022 Share Posted December 21, 2022 2 hours ago, FFREDIANELLI said: Some help will be appreciated , thenks in advance. Try this approach: function beforeInit(sender, config) { var groupingFeature = Ext.create('Ext.grid.feature.Grouping', { groupHeaderTpl: new Ext.XTemplate( '{columnName}: {[this.toDMY(values)]} ({[this.countTotal(values.rows)]})', '', { countTotal: function(records) { var totalSum = 0; totalSum = records.length; return totalSum; }, toDMY: function(value) { return Ext.Date.format(value.renderedGroupValue, "d/m/Y"); } } ), hideGroupedHeader: true }); config.features = [groupingFeature] } Quote Link to comment Share on other sites More sharing options...
FFREDIANELLI Posted December 21, 2022 Author Share Posted December 21, 2022 Perfect ! Thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.