This is a migrated thread and some comments may be shown as answers.

PivotGrid Template cannot access measure field on single measure

2 Answers 144 Views
PivotGrid
This is a migrated thread and some comments may be shown as answers.
The Cowboy
Top achievements
Rank 1
The Cowboy asked on 11 Feb 2016, 09:04 PM

I'm unable to access the measure field in a dataCellTemplate when it's by itself and a column dimension is set. measure returns undefined. How can I determine the measure in this scenario?

Please see examples from dojo. 

Thanks, 

2 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Krustev
Telerik team
answered on 15 Feb 2016, 01:28 PM
Hello,

Currently, the widget passes the measure name when there are more then one measures applied. When a single measure is set, then it is known and the template information does not contain the measure name.

To workaround this behavior, you will need to get the measure information from the PivotGrid datasource component:
<script id="dataCellTemplate" type="text/x-kendo-template">
    # var pivotgrid = $("\#pivotgrid").data("kendoPivotGrid"); #
    # measure = measure || pivotgrid.dataSource.measures()[0]; #
    # if(measure) { #
    # console.log(measure.name); #
    # } #
    #: dataItem.value #
</script>

Regards,
Georgi Krustev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
The Cowboy
Top achievements
Rank 1
answered on 16 Feb 2016, 09:23 PM

Worked perfectly.

Thanks

Tags
PivotGrid
Asked by
The Cowboy
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
The Cowboy
Top achievements
Rank 1
Share this question
or