We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

grid with dynamic columns fire databound event in bucle

Thread ID:

Created:

Updated:

Platform:

Replies:

147783 Sep 24,2019 07:46 AM UTC Sep 27,2019 07:30 AM UTC Angular - EJ 2 3
loading
Tags: Grid
Manolo Capdevila
Asked On September 24, 2019 07:46 AM UTC

Hi,

I need a grid but I don't know the column's number in each query, so I need dynamic columns.

For smallest screen, I need scroll this grid. I set the witdh in each column in databound event. The scroll appear, but i doesn't work fine.

I attach an example

Thanks

Attachment: dynamiccolumnsresponsive_9e1d304a.zip

Thavasianand Sankaranarayanan [Syncfusion]
Replied On September 25, 2019 09:49 AM UTC

Hi Manolo, 
 
Greetings from Syncfusion support. 
 
Query: grid with dynamic columns fire databound event in bucle 
 
We have checked your query and we are able to reproduce the reported problem at our end with the provided sample. The grid.refreshColumns method is called repeatedly which is the cause of the issue. You can resolve the reported problem by using boolean variable like below. Refer below code snippets and sample for your reference. 
 
[code example] 
... 
export class AppComponent { 
  public data: Object[] = []; 
  @ViewChild('grid', { static: true }) public grid: GridComponent; 
  public initial: boolean = true; 
 
  ngOnInit(): void { 
    this.data = [ 
      { OrderID: 1, CustomerID: 'VINET', Freight: 32.3800, OrderDate: '1996-07-02T00:00:00.000Z', City: 'Paris', Price: 300 }, 
      ... 
   ]; 
  } 
 
  dataBound(args: any) { 
    if (this.initial) { 
      for (const cols of this.grid.columns) { 
        ... 
     } 
      this.grid.refreshColumns(); 
      this.initial = false; 
    } 
  } 
} 
 
 
Please get back to us if you need further assistance. 
 
Regards, 
Thavasianand S. 


Manolo Capdevila
Replied On September 27, 2019 07:28 AM UTC

Thanks

Thavasianand Sankaranarayanan [Syncfusion]
Replied On September 27, 2019 07:30 AM UTC

Hi Manolo, 
 
Thanks for your update. 
 
We are happy that the problem has been resolved at your end. 
 
Regards, 
Thavasianand S.  


CONFIRMATION

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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon