jQuery UI Widgets Forums Grid call to refreshfilterrow error when grid is created in hidden parent

This topic contains 3 replies, has 2 voices, and was last updated by  Hristo 5 years, 1 month ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author

  • Kaddath
    Participant

    Hi!

    I hope I don’t bother you with my bug reports, but I feel it’s better to report them, even when I can use a quite simple workaround to prevent them..

    In our code, grids are sometimes created in a tab that is still hidden at that moment, and actions are performed on them “in the background”. So far they behave great, rows can even be selected and events triggered (even if as I’ve noticed with this bug, the grid is not visually initialized yet; actually I had trouble to find that being hidden was the condition for the error to happen).

    So, when the grid is an a hidden div, and is created with showfilterrow: true, so far everything is OK. But if a call to jqxGrid('refreshfilterrow') is made while still hidden, this error happens:
    “TypeError: this.columns.records is undefined”

    You can try it here: https://jseditor.io/?key=e48ef582f66911e9a73300224d6bfcd5
    Once the parent div is shown, the error doesn’t happen.

    Thanks by advance,
    Kaddath


    Hristo
    Participant

    Hello Kaddath,

    Could you clarify it?
    What is your final goal?
    Because this is a refresh method and it makes transformations and does actions over the existing elements but if you set display: none it is difficult to do this.
    Please, take a look at this workaround.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    https://www.jqwidgets.com


    Kaddath
    Participant

    Thanks for the answer,

    I’ll try to explain it simply, I can’t really share all the code because it’s really long: we have a wrapper class for grids that automatically plugs to a data set component with hidden “system fields” (that the data set uses internally). On creation, filters are added to these system fields and by default, our function to add filters refreshes the row (which seemed a logical thing to do, because these system columns are not always hidden -our debug mode-).

    So it didn’t happen until now, but grids can be in a tab that is created but still not shown. We can’t use this workaround because that would imply to show the tab (select it), however I used another one which consists in an extra parameter to our add filter function, to optionnaly not refresh the row when the grid is in creation.

    If works so far, but it just seemed to me better idea to solve the error at the source, and add an extra test to refreshfilterrow, something like if(!this.columns.records){ return; } so that there is no error in the console.. That’s why I reported here.

    Kaddath


    Hristo
    Participant

    Hello Kaddath,

    Thank you for this clarification.
    Yes, the mentioned approach looks good.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    https://www.jqwidgets.com

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

You must be logged in to reply to this topic.