Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
147399 | Sep 9,2019 03:23 PM UTC | Sep 26,2019 06:49 AM UTC | Angular - EJ 2 | 9 |
![]() |
Tags: PivotGrid |
let pivotObj: PivotView = new PivotView({
//....
dataBound(): void {
trend();
},
cellTemplate: '${getCellContent(data)}',
});
(<{ getCellContent?: Function }>window).getCellContent = (e: any): any => {
let template: string;
if (e && e.targetCell.className.indexOf('e-valuescontent') > -1 ) {
template = '<input id= "element'+ i +'" type="checkbox">'; //Here, you can append the html elements
i++;
} else {
template = '';
}
return template;
};
function trend() {
//....
for (let rnt: number = 0, Lnt = fieldHeaders; rnt < Lnt.length; rnt++) {
let row: number = fields[fieldHeaders[rnt]];
for (var j = 0, ci = 1; j < cLen && ci < colLen; j++ , ci++) {
let node: HTMLElement = cTable[3].children[1].children[row].childNodes[j] as HTMLElement;
let checkbox1: CheckBox = new CheckBox({ checked: false, change: onChange,
created: () => {
removeClass([node.lastElementChild.querySelector('.e-frame')], 'e-icons');
} });
checkbox1.appendTo(node.lastElementChild as HTMLElement); //create check boxes for the appended html input types.
node.firstElementChild.remove();
checkbox1.checked = j==0? false: true
}
}
}
}
} |
Query |
Response | |
Can you please create another stackblitz demo using minimal json data (preferably only 10 -15 records)? |
As per you request, we have created a minimal level sample for your convenience.
| |
Also, can you show me how I could find out the Ids of the selected checkboxes, on clicking a button? |
You can get the ids of selected checkboxes on button click through the following code snippet.
Code snippet: [JavaScript]
Meanwhile, we have prepared sample for your convenience.
Screenshot:
|
Query |
Response |
none of the checkboxes in your angular sample is clickable. Can you please fix it? |
Please find the modified sample here.
|
Also, I would like to hide the "Grand Total" column AND row. How can I do that? |
You can hide grand totals by the property “showGrandTotals:false” inside dataSourceSettings.
Documentation link: https://ej2.syncfusion.com/angular/documentation/pivotview/summary-customization/#showhide-grand-totals
|
import { Component, OnInit, ViewChild, Inject, ViewEncapsulation } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
export class AppComponent {
constructor(private sanitizer: DomSanitizer) {
}
getCellContent(e): void {
if (e && e.targetCell.className.indexOf('e-valuescontent') > -1 ) {
template = this.sanitizer.bypassSecurityTrustHtml('<input type="checkbox">'); //Here, you can append the html elements
}
else {
template = this.sanitizer.bypassSecurityTrustHtml('');
}
return template;
}
}
|
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.
This page will automatically be redirected to the sign-in page in 10 seconds.