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. Image for the cookie policy date

How to get instance of Syncfusion component (ejGrid) and how to use methods

Hey

What is the best way to get instance of Syncfusion component (for instance: ejGrid) without using ID?

At the moment I'm using this:

I get some kind of instance, but there are no methods which would be useful for me. None of them from API page. At the moment, my goal is to reload grid by using refreshContent.
How can I do that?

ie: myGridComponent.widget.refreshContent(true); <-- not working



2 Replies

ME Me February 22, 2017 12:49 PM UTC

Oooops - my bad. Looks like there are those methods, even if I don't see them through console.log(); 

For anyone who will be looking:

// ------------------------------------
import { EJComponents } from './../../../../../../node_modules/ej-angular2/src/ej/core'; <--- Path might be different, depends where about is your current component

@Component({
selector: 'mySelectorName'
 template: `<ej-grid #myGrid></ej-grid>
})

@ViewChild('myGrid') myGridComponent: EJComponents<ej.Grid, any>;

  public Refresh()
  {
    this.myGridComponent.widget.refreshContent(true);
  }
// ------------------------------------


or

// ------------------------------------
@Component({
selector: 'mySelectorName'
 template: `<ej-grid #myGrid></ej-grid>
})

@ViewChild('myGrid') grid:any;

  public Refresh()
  {
    this.
grid.widget.refreshContent(true);
  }
// ------------------------------------


Solved.


PK Prasanna Kumar Viswanathan Syncfusion Team February 23, 2017 05:11 AM UTC

Hi Mantelis, 

Thanks for contacting Syncfusion support. 

We are happy to hear that your issue has been solved. 

Please get back to us if you need any further assistance. 

Regards, 
Prasanna Kumar N.S.V 


Loader.
Up arrow icon