erich.wanker Posted September 7, 2020 Share Posted September 7, 2020 HI, in a table - i have a lot of persons - and 50% are in different categories - 50% are in no category (must be a empty database field !!) i use TUniDBGrid - Grouping with Fieldname "category-Name" and FieldCapture "Category-Name" Works fine ! :-) BUT: I want change the caption of group header to "Persons without Categories" if the "category-Name" is empty ??? Actual i have a uniDBGrid like this + Category-Name: <- here are all Records without Category + Category-Name: FisteCategoryDescription + Category-Name: SecondCategoryDescription + Category-Name: and so on ... I want a uniDBGrid like this + Persons without Categories + Category-Name: FisteCategoryDescription + Category-Name: SecondCategoryDescription + Category-Name: and so on ... ThanX Erich Quote Link to comment Share on other sites More sharing options...
mhmda Posted September 8, 2020 Share Posted September 8, 2020 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]; } Grid->Unievents I already explained that in one of my videos :-) 1 Quote Link to comment Share on other sites More sharing options...
erich.wanker Posted September 8, 2020 Author Share Posted September 8, 2020 WOW .. THANX a lot :-) ... works perfect !!!! i stored it in "onFrameCreate" and search the right index number gruppenname_id:='0'; cnt := Mydbgrid.Columns.Count; for colIdx := 0 to cnt - 1 do begin if Mydbgrid.Columns[colIdx].FieldName = 'gruppenname' then gruppenname_id:= inttostr(colIdx); end; Mydbgrid.ClientEvents.UniEvents.Add('beforeInit=function beforeInit(sender, config)'+ '{ '+ ' config.groupingFeature = Ext.create('+#39+'Ext.grid.feature.Grouping'+#39+',{ '+ ' groupHeaderTpl:new Ext.XTemplate('+#39+'{[this.getGroupTitle(values.rows[0])]}'+#39+','+ ' { '+ ' getGroupTitle: function(values) {'+ ' if(values.data['+gruppenname_id+']=='+#39+''+#39+')'+ ' return '+#39+'All the ungroupt Things are here :-) '+#39+';'+ ' else '+ ' return '+#39+'Gruppenname: '+#39+'+values.data['+gruppenname_id+']; '+ ' } '+ ' })'+ ' });'+ ' config.features= [config.groupingFeature]; '+ ' } '); 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.