erich.wanker Posted January 28, 2022 Share Posted January 28, 2022 Hi, i use following code to display the total count of a Group in the Groupheade function beforeInit(sender, config) { 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] } My basic Groupfield is GROUPNUMBER (this is not changeable) So the outpu of GroupHeader is: Groupnumber 12345 (999) Now i want to ADD the value of database-field "groupname" It should output a GroupHeader: Groupnumber 12345 - Groupname This is a Textttext stored in the field "groupname" (999) i found this source from mhmda: function beforeInit(sender, config) { config.groupingFeature = Ext.create('Ext.grid.feature.Grouping',{ groupHeaderTpl:new Ext.XTemplate('{[this.getGroupTitle(values.rows[0])]}', { getGroupTitle: function(values) { if(values.data[1]=='') return 'My custom title: '+values.data[8];/*<--[8]field index*/ else return 'Other title: '+values.data[2];/*<--[2]field index*/ } }) }); config.features= [config.groupingFeature]; } how can i combinate this two things??? Quote Link to comment Share on other sites More sharing options...
erich.wanker Posted January 28, 2022 Author Share Posted January 28, 2022 i inserted following: '{columnName}: {name} - Gruppenname: {values.data[20]} ({[this.countTotal(values.rows)]})', but it doesnt put out the values from field "groupname" with ColIndex 20 in this case Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 28, 2022 Share Posted January 28, 2022 Hello Erich, Do you have a simple testcase to check? Quote Link to comment Share on other sites More sharing options...
erich.wanker Posted January 28, 2022 Author Share Posted January 28, 2022 TESTCASE Between Output of CountryGroup and TotalCount i want the value of field "City" Description: My Datastructure is simmilar to the records of Group "British West Indies" - all "Citys" are the same .. which record of the group is used to get the "Grand Cayman"-Text doesnt matter testcase.zip Quote Link to comment Share on other sites More sharing options...
Hayri ASLAN Posted January 29, 2022 Share Posted January 29, 2022 20 hours ago, erich.wanker said: TESTCASE Between Output of CountryGroup and TotalCount i want the value of field "City" Description: My Datastructure is simmilar to the records of Group "British West Indies" - all "Citys" are the same .. which record of the group is used to get the "Grand Cayman"-Text doesnt matter testcase.zip 32.58 kB · 1 download Hello Please use below code. (Please use children instead of rows and rows is deprecated) PRO TIP : add {[console.log(values)]} into groupHeaderTpl to see the values in the console. function beforeInit(sender, config) { config.groupingFeature = Ext.create('Ext.grid.feature.Grouping', { groupHeaderTpl: new Ext.XTemplate('{[this.getGroupTitle(values.rows[0]]}', { getGroupTitle: function (values) { if (values.data[0] == '') return 'Alle 8D Änderungsreporte ohne Gruppenzuordnung'; else return 'Gruppenname: <b>' + (values.data[0]).replace(/[&\/\\#,+()$~%.":*?<>{}]/g, ""); '</b>'; } }) }); config.features = [config.groupingFeature]; var groupingFeature = Ext.create('Ext.grid.feature.Grouping', { groupHeaderTpl: new Ext.XTemplate('{columnName}: {name} - 1st CountryName: {[values.children.at(0).get(4)]} - TotalCount: ({[this.countTotal(values.children)]})', '', { countTotal: function (records) { var totalSum = 0; totalSum = records.length; return totalSum; } }), hideGroupedHeader: true }); config.features = [groupingFeature] } 1 Quote Link to comment Share on other sites More sharing options...
erich.wanker Posted January 31, 2022 Author Share Posted January 31, 2022 WOW 🙂 PERFECT !!! Thank YOU !!!!! Works great !! 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.