The wjCore.isArray does not work correctly for multiple browser windows

Posted by: sp7 on 20 December 2017, 12:41 am EST

    • Post Options:
    • Link

    Posted 20 December 2017, 12:41 am EST

    In trying to consolidate our data to one instance in a top window and have other components use it in child windows we are encountering a roadblock with the FlexGrid. It boils down to the grid expecting an array for its data and the isArray check performed below does not work across windows.

    function isArray(value) {

    return value instanceof Array;

    }

    Can the isArray function be changed to work across windows? Below are some posts describing alternate methods that are supposed to work.

    https://stackoverflow.com/questions/6473273/why-are-myarray-instanceof-array-and-myarray-constructor-array-both-false-wh

    https://stackoverflow.com/questions/4775722/check-if-object-is-array

  • Posted 20 December 2017, 8:56 pm EST

    Hi,

    As per understanding, you have a global array and this is bound to the FlexGrid and it gets failed to bound to FlexGrid because of isArray method.

    Please confirm and provide demo sample if possible.

    ~Manish

  • Posted 21 December 2017, 1:57 am EST

    Correct. The below plnkr demostrates the behavior with the mulit-select, but it is the same for the flexgrid. If you go to developer tools and view the console on the child window, you will see the error being thrown saying “Error: ** Assertion failed in Wijmo: Array expected.”. You can see that sharedData still has the array, but the error is thrown by the wijmo component because the child window’s array prototype is different and therefor instanceof fails.

    http://run.plnkr.co/Xr3WdeU1WKlcMHiF/

  • Posted 21 December 2017, 2:11 am EST

    Seems I got the plnkr url wrong. This should work:

    http://embed.plnkr.co/VBhtOg34mHedHmnftmJt/

  • Posted 21 December 2017, 8:11 pm EST

    Hi,

    Thank you for the sample. We are able to replicate the issue and forwarded to the concerned team for discussion with internal tracking id 302186.

    ~Manish

  • Posted 2 January 2018, 8:53 pm EST

    Hi,

    This issue is fixed and this has been verified with build 5.20173.399. Please refer to your original plunker for the same.

    http://embed.plnkr.co/VBhtOg34mHedHmnftmJt/

    wjCore.isArray can be verified in following plunker:

    http://plnkr.co/edit/HgTv2CzyWbjtjE9gBRJM?p=preview

    The build 5.20173.399 may be downloaded from following link for testing purpose only.

    http://prerelease.componentone.com/wijmo5/

    The next maintenance released may not be estimated right now. The next build is under QA.

    ~Manish

  • Posted 9 January 2018, 12:42 am EST

    Thanks, that fixed this wjCore.isArray, but we have experienced the same issue in the wjCore.isDate. Can a similar fix be added to wjCore.isDate please?

    
    function isDate(t)
    {
    return (t instanceof Date||
    "[object Date]"===Object.prototype.toString.call(t))
    &&!isNaN(t.getTime())
    }
    
    

    Also, it appears that the wjCore.tryCast function is also using instanceof not sure if this can/should be changed.

  • Posted 9 January 2018, 7:28 pm EST

    Hi,

    We have reported these to the concerned team with internal id #304704.

    We will let you know as we get any update on this.

    ~Manish

  • Posted 16 January 2018, 10:26 pm EST

    Hi,

    The isDate method has been updated and this fix will be included in the build 404+ which is expected to be release in March 2018 with version name 2018v1.

    ~Manish

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels