jQWidgets Forums
jQuery UI Widgets › Forums › Angular › Angular2 autoresizecolumns
Tagged: Angular2, autoresizecolumns, grid
This topic contains 6 replies, has 2 voices, and was last updated by Martin 6 years, 9 months ago.
-
Author
-
Hi,
How to set autoresizecolumns in angular2 jqxgrid?
Hello Ravikumar Sutagunid,
Here is a Demo on how you can use autoresizecolumns in Angular jqxGrid.
Best Regards,
MartinjQWidgets Team
http://www.jqwidgets.com/Thanks Martin for your reply. Can’t this be done on grid load rather doing it on button click?
Regards,
RaviHi Martin,
I tried the demo shared by you. However, it gives me below error.
onAutoResize(){
this.myGrid.autoresizecolumns();
}ERROR TypeError: Cannot read property ‘autoresizecolumns’ of undefined
Hello Ravikumar Sutagunid,
Yes, it could also be done on grid load.
It seems that the grid is not yet created, when you call the onAutoResize method.
You can do this in Angular’s AfterViewInit life hook.
Here is an updated Example.Best Regards,
MartinjQWidgets Team
http://www.jqwidgets.com/Thanks martin for the reply. I tried with the example shared by you.
However, I am still getting the same error.
I tried in both ngAfterViewInit & ngAfterViewChecked. Still getting the same error.ERROR TypeError: Cannot read property ‘autoresizecolumns’ of undefined
at PreviewComponent.ngAfterViewInit (preview.component.ts:471)
at callProviderLifecycles (core.es5.js:11176)
at callElementProvidersLifecycles (core.es5.js:11147)
at callLifecycleHooksChildrenFirst (core.es5.js:11131)
at checkAndUpdateView (core.es5.js:12259)
at callViewAction (core.es5.js:12599)
at execEmbeddedViewsAction (core.es5.js:12557)
at checkAndUpdateView (core.es5.js:12252)
at callViewAction (core.es5.js:12599)
at execComponentViewsAction (core.es5.js:12531)
at checkAndUpdateView (core.es5.js:12257)
at callViewAction (core.es5.js:12599)
at execEmbeddedViewsAction (core.es5.js:12557)
at checkAndUpdateView (core.es5.js:12252)
at callViewAction (core.es5.js:12599)Hello Ravikumar Sutagundi,
Have you put
#myGrid
selector on the jqxGrid element in the html file and select it with@ViewChild('myGrid') myGrid: jqxGridComponent;
?If yes, can you send a your code, so I can take a look what might be the issue?
Thank you!Best Regards,
MartinjQWidgets Team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.