Jump to content

Can I add extra text in dbgrouped field row?


Freeman35

Recommended Posts

Not good solution, but works for me. Why NOT good: I add calculated field and haveto give size 200byte. this mean 200 x RowCount and times session count. byte can be huge on server ram lost.

    object Q_GRP_Field: TStringField
      DisplayLabel = 'Field name'
      FieldKind = fkCalculated
      FieldName = 'GRP_Field'
      Size = 200
      Calculated = True
    end

Add calculated field,
 

procedure TFRM_Tabela.Q_CalcFields(DataSet: TDataSet);
var S: string;
begin
  if DataSet.FieldByName('TBL_KB_TUTAR').AsFloat<0.0then S:= '<span class=''GRDStyle2''>( Fazla: '
  else S:= '<span class=''GRDStyle4''>( Kişibaşı: ';

  DataSet.FieldByName('GRP_Field').AsString:= DataSet.FieldByName('TAB').AsString
   +'&nbsp;&nbsp; <span class=''GRDStyle4''> ( İaşe bedeli: ' +DataSet.FieldByName('BEDELI').DisplayText +' TL. )&nbsp;&nbsp;&nbsp;</span>'
   +S +DataSet.FieldByName('TBL_KB_TUTAR').DisplayText +' )</span>';
end;

and result :)

Ekran Resmi 2019-02-18 12.19.17.png

Link to comment
Share on other sites

Many times I use custom text in group header, so server side doesn't give much options so I use client side: Ext.XTemplate.

Example:

config.groupingFeature = Ext.create('Ext.grid.feature.Grouping',{
   groupHeaderTpl:new Ext.XTemplate('<table class="defaultfont defaultfontsize11"><tr>'+
                   '<td style="font-weight:bold;color:#e62b1e;">'+
                   '{[this.getGroupTitle(values.rows[0])]}</td><td>'+
                   '({[values.children.length]} pax.)</td></tr></table>',
    {
      getGroupTitle: function(values) {                                      
              return   values.data[3][0];                                    
        }
     })   
  });
  
  config.features= [config.groupingFeature];

 And the the result:

GR.png

Link to comment
Share on other sites

Thank you mhmda.

My problem is I don't know js :unsure: ( and hate it :) )

In my app, client side has not that values, I need two colums "İaşe bedeli" this column not in grid so not on clientside, TBL_KB_TUTAR is added but need to grouped sum. Needed result iaşe bedeli - sum(TBL_KB_TUTAR) and been colored or css and bla bla.

So compicated for me, I have to learn many js function and more then extjs class, property....

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...