We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Customize collapsable row data

Thread ID:

Created:

Updated:

Platform:

Replies:

151019 Jan 28,2020 11:43 AM UTC Jan 29,2020 09:15 AM UTC React - EJ 2 1
loading
Tags: Grid
Oscar Ramos
Asked On January 28, 2020 11:43 AM UTC

It is posible to customize the grouping row data?

I want to set the row text to something like --> TOTAL of group: xxxx



Prasanna Kumar Viswanathan [Syncfusion]
Replied On January 29, 2020 09:15 AM UTC

Hi Oscar, 
 
Greetings from syncfusion support 
 
Query#: I want to set the row text to something like --> TOTAL of group: xxxx 
 
From analyzing your query we understand you want to customize the grouping row text in grid. You can customize the group caption by using the groupSettings.captionTemplate property.  
 
Please refer the below code example, sample and documentation for more information. 
 

export class Grouping extends SampleBase { 
    constructor() { 
        super(...arguments); 
        this.groupOptions = { showGroupedColumn: false, columns: ['Country'], 
        captionTemplate:'#groupTemplate' 
}; 
    } 
    dataBound() { 
        if (refresh) { 
            this.gridInstance.groupColumn('Country'); 
            refresh = false; 
        } 
    } 
    load() { 
        refresh = this.refreshing; 
    } 
    render() { 
        return (<div className='control-pane'> 
                <div className='control-section'> 
                    <GridComponent dataSource={inventoryData} allowPaging={true} ref={grid => this.gridInstance = grid} pageSettings={{ pageCount: 5 }} allowGrouping={true} groupSettings={this.groupOptions} allowSorting={true} height="320" dataBound={this.dataBound.bind(this)} load={this.load}> 
                        <ColumnsDirective> 
                             .  .  .  .  .  .  . 
                             .  .  .  .  .  .  . 
                        </ColumnsDirective> 
                        <Inject services={[Page, Group, Sort]}/> 
                    </GridComponent> 
                </div> 
            </div>); 
    } 
} 
 
Index.html 

<script id="groupTemplate" type="text/x-template"> 
            ${groupTemplate(data)} 
  </script> 
        <script type="text/javascript"> 

function groupTemplate(args) { 
    if (args.field == "Country") {            //we have customize the caption only for country field 
        return "TOTAL of group:" + args.count + " item"; 
    } 
} 
</script> 
 
 
 
Regards,
Prasanna Kumar N.S.V
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon