Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to use headerRenderer with headerText?

3517882Apr 8 2019 — edited Apr 9 2019

I have a ojTable with headerText dynamically generated based on some variable. After applying sort, the headerText is not changing at all. I have tried to implement using headerRenderer but first only headerRenderer is working (i.e. If I put breakpoint on return statement, then I can see the required string printed as header text) and then its showing blank for that particular column.

Here is my sample code

<table id="aggTable" data-bind="ojComponent: {component: 'ojTable',

                            data: aggregatedDataSource,

                            display: 'grid',

                            columnsDefault: {sortable: 'enabled'}, columns: [

                            {headerText: $data.l10n_default('test.toolbar.option.',$data.selectedReportType()), headerRenderer: headerRendererImpl,  field: 'itemName'},

                            {headerText: oj.Translations.getTranslatedString('test.report.column.hostCount'), renderer: hostCountRenderer, sortProperty: 'hostCount'}]}">

</table>

self.headerRendererImpl = function(headerContext) {

            console.log("Inside headerRenderer");

            var header = self.l10n_default('test.toolbar.option.', self.selectedReportType());

            console.log(header)

            return {'insert': header}

        }

Both the console logs are getting printed properly but the value is not displayed on table header.

What am I missing? Any help would be highly appreciated.

Thanks

Comments
Post Details
Added on Apr 8 2019
2 comments
1,012 views