jQWidgets Forums

jQuery UI Widgets Forums Grid order of grid initialization

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

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • order of grid initialization #104117

    mathod
    Participant

    Hello
    I have a problem.
    I have 2 grids, called Grid1 and Grid2.

    CellClassName of Grid2 is depending of Grid1.
    But sometimes, (I think), grid 2 is initialized before Grid1, and in CellClassName when i call this.Grid1.getRows(), it return me empty array.
    And it’s why my cellClassName doesn’t work well.

    Can i priorize an order to initialized my grids ?

    Maybe, in ngOnInit, I can call grid1.refresh() and after grid2.refresh(). It seems to be working, but i don’t know if it’s the good way.

    Thanks a lot

    order of grid initialization #104123

    Martin
    Participant

    Hello mathod,

    Yes, this is a possible solution. However, I think that it would be better to use the ngAfterViewInit lifecycle hook,
    so you are sure the grids are created.
    Another thing you can do is to use the rendered callback of the first grid and inside it to set the columns or refresh the second grid.

    Best Regards,
    Martin

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

    order of grid initialization #104256

    mathod
    Participant

    Thanks, I have resolved this problem.
    But I have an other problem now..

    My imageRenderer in my grid, is depending of a variable which is initialize by a get request in y constructor.

    But, sometimes ( 1 time/2), my request grid is initialize before my get request called… So my var is undefined and my imageRenderer doesn’t work and I have this message :
    undefined:1 GET http://localhost:4200/assets/setup/composition/undefined 404 (Not Found)

    I understand this error, but I don’t know how can I call get request BEFORE grid Initialization…
    Is it possible to initialize my grid After constructor call

    thanks a lot

    order of grid initialization #104257

    mathod
    Participant

    Maybe I can put my grid in a div :

    <div *ngIf="GetRequestDone"> MY GRID </div>

    Like that, my grid is created when my data are load…
    But is it the good way ? …

    order of grid initialization #104298

    Martin
    Participant

    Hello mathod,

    Yes, this is a possible solution.
    Otherwise, you can wait for the get request to finish and then update the grid’s columns with the imagerenderer.

    Best Regards,
    Martin

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

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

You must be logged in to reply to this topic.