Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
149623 | Dec 3,2019 05:31 PM UTC | Dec 6,2019 04:48 AM UTC | Angular - EJ 2 | 4 |
![]() |
Tags: Grid |
<ejs-grid [dataSource]='data' height='315' gridLines= ‘Horizontal’ >
|
import { Component, OnInit,ViewChild } from '@angular/core';
import { data } from './datasource';
import {GridComponent} from '@syncfusion/ej2-angular-grids';
@Component({
selector: 'app-container',
template: `<ejs-grid #grid [dataSource]='data' gridLines= "Horizontal" (dataBound)="dataBound($event)" [allowSorting]='true' height='315px'>
-------
</ejs-grid>`
})
export class AppComponent implements OnInit {
public data: Object[];
@ViewChild('grid')
public grid: GridComponent;
ngOnInit(): void {
this.data = data;
}
dataBound(e){
for (var i = 0; i < this.grid.getHeaderTable().querySelectorAll('.e-headercell').length; i++) {
var margin = this.grid.getHeaderTable().querySelectorAll('.e-headercell')[i].offsetWidth - (42+(this.grid.getHeaderTable().querySelectorAll('.e-headertext')[i].offsetWidth ) + 10); // 42 - headerText padding & 10 is used for adjustment purpose
this.grid.getHeaderTable().querySelectorAll('.e-sortfilterdiv')[i].style.marginRight = margin + "px";
}
}
}
|
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.