Skip to content

Instantly share code, notes, and snippets.

View maxkoretskyi's full-sized avatar

Max Koretskyi maxkoretskyi

View GitHub Profile
let columnDefs = [
{
headerName: 'Athlete',
field: 'athlete',
tooltipField: 'athlete'
},
...
]
let columnDefs = [
{
headerName: 'Athlete',
field: 'athlete',
tooltipField: 'athlete'
},
...
]
let columnDefs = [
{
field: "age",
width: 90,
filter: 'agNumberColumnFilter',
filterParams: {
filterOptions: [
'greaterThan',
{
displayKey: 'greaterThanWithNulls',
let columnDefs = [
{
field: "age",
width: 90,
filter: 'agNumberColumnFilter',
filterParams: {
filterOptions: [
'lessThan',
'greaterThan'
]
let gridOptions = {
loadingCellRenderer: 'customLoadingCellRenderer',
components: {
customLoadingCellRenderer: CustomLoadingCellRenderer,
},
...
}
class CustomLoadingCellRenderer {
init(params) {
const text = 'One moment please...';
this.eGui = document.createElement('div');
this.eGui.innerHTML =
'<div class="ag-custom-loading-cell">' +
' <i class="fas fa-spinner fa-pulse"></i> <span>' + text + ' </span>' +
'</div>';
}
class CustomLoadingCellRenderer {
init(params) {
this.eGui = document.createElement('div');
this.eGui.innerHTML =
'<div class="ag-custom-loading-cell" style="padding-left: 10px; line-height: 25px;">' +
' <i class="fas fa-spinner fa-pulse"></i> <span>' + params.loadingMessage + ' </span>' +
'</div>';
}
getGui() {
let gridOptions = {
defaultColDef: {
...
tooltipComponent: 'customTooltip'
},
components: {
customTooltip: CustomTooltip,
},
...
};
class CustomTooltip {
init(params) {
var eGui = this.eGui = document.createElement('div');
var color = params.color || 'white';
var data = params.api.getRowNode(params.rowIndex).data;
eGui.classList.add('custom-tooltip');
eGui.style['background-color'] = color;
eGui.innerHTML =
'<p><span class"name">' + data.athlete + '</span></p>' +
this._componentRef = this.createComponent();
this._agAwareComponent = this._componentRef.instance;
this._frameworkComponentInstance = this._componentRef.instance;
this._eGui = this._componentRef.location.nativeElement;