jQWidgets Forums

jQuery UI Widgets Forums Angular Angular2 autoresizecolumns

This topic contains 6 replies, has 2 voices, and was last updated by  Martin 6 years, 9 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • Angular2 autoresizecolumns #101071

    Ravikumar Sutagundi
    Participant

    Hi,

    How to set autoresizecolumns in angular2 jqxgrid?

    Angular2 autoresizecolumns #101100

    Martin
    Participant

    Hello Ravikumar Sutagunid,

    Here is a Demo on how you can use autoresizecolumns in Angular jqxGrid.

    Best Regards,
    Martin

    jQWidgets Team
    http://www.jqwidgets.com/

    Angular2 autoresizecolumns #101105

    Ravikumar Sutagundi
    Participant

    Thanks Martin for your reply. Can’t this be done on grid load rather doing it on button click?

    Regards,
    Ravi

    Angular2 autoresizecolumns #101109

    Ravikumar Sutagundi
    Participant

    Hi 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

    Angular2 autoresizecolumns #101152

    Martin
    Participant

    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,
    Martin

    jQWidgets Team
    http://www.jqwidgets.com/

    Angular2 autoresizecolumns #101174

    Ravikumar Sutagundi
    Participant

    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)

    Angular2 autoresizecolumns #101214

    Martin
    Participant

    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,
    Martin

    jQWidgets Team
    http://www.jqwidgets.com/

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.