jQuery UI Widgets Forums Navigation Tree Cannot use addTo – id error

This topic contains 1 reply, has 2 voices, and was last updated by  Todor 1 year, 3 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Cannot use addTo – id error #105081

    pantxisto
    Participant

    Hello,

    I´m using ANGULAR tree like this:

    <jqxTree #treeReference [auto-create]=”false” (onSelect)=”Select($event)”></jqxTree>

    I´m charging data when arrives in observable like this:

    const source = {
    dataType: ‘json’,
    dataFields: [
    { name: ‘label’, type: ‘string’, map: ‘text’ },
    { name: ‘items’, type: ‘array’ },
    { name: ‘id’, type: ‘string’ },
    { name: ‘deviceFullName’, type: ‘string’ },
    { name: ‘deviceId’, type: ‘string’ },
    { name: ‘hasChildren’, type: ‘bool’ },
    { name: ‘type’, type: ‘string’ }
    ],
    hierarchy:
    {
    root: ‘items’
    },
    id: ‘id’,
    localData: tree
    };
    const dataAdapter = new $.jqx.dataAdapter(source, { autoBind: true });
    this.tree.source(dataAdapter.records);

    All works fine.

    Problems start if I receive data to charge in some concrete node:

    I parse data like this:

    const source = {
    dataType: ‘json’,
    dataFields: [
    { name: ‘label’, type: ‘string’, map: ‘text’ },
    { name: ‘items’, type: ‘array’, map: ‘IObjects’ },
    { name: ‘propertiesValues’, type: ‘array’ },
    { name: ‘id’, type: ‘string’ },
    { name: ‘IObjectId’, type: ‘string’ },
    { name: ‘IObjectFullName’, type: ‘string’ },
    { name: ‘IObjectFullId’, type: ‘string’ },
    { name: ‘type’, type: ‘string’ },
    { name: ‘version’, type: ‘string’ },
    { name: ‘hasIObjectChildren’, type: ‘bool’ },
    ],
    hierarchy:
    {
    root: ‘items’
    },
    id: ‘id’,
    localData: parsedDeviceTree
    };
    const dataAdapter = new $.jqx.dataAdapter(source, { autoBind: true });

    And I try to add to the node like this:

    this.tree.addTo(dataAdapter.records, id);

    The id, of course is what is expected.

    Console throws the next error:
    Cannot read property ‘id’ of undefined
    at c.<computed>.addTo (jqxtree.js:8)
    at Object.push../node_modules/jqwidgets-scripts/jqwidgets/jqxcore.js.b.jqx.invoke (jqxcore.js:15)
    at Object.push../node_modules/jqwidgets-scripts/jqwidgets/jqxcore.js.b.jqx.jqxWidgetProxy (jqxcore.js:15)
    at HTMLDivElement.<anonymous> (jqxcore.js:15)
    at Function.each (jquery.min.js:2)
    at w.fn.init.each (jquery.min.js:2)
    at w.fn.init.b.fn.<computed> [as jqxTree] (jqxcore.js:15)
    at jqxTreeComponent.push../node_modules/jqwidgets-scripts/jqwidgets-ts/angular_jqxtree.ts.jqxTreeComponent.addTo (angular_jqxtree.ts:338)
    at SafeSubscriber._next (tree.component.ts:116)
    at SafeSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.__tryOrUnsub (Subscriber.js:196)

    I try simpler example like this:

    this.tree.addTo({label: ‘prueba’}, id);

    But still the same error.

    Help.

    Cannot use addTo – id error #105101

    Todor
    Participant

    Hello pantxisto,

    Please review the following example whether it fits your needs.

    Let us know if you need further assistance.

    Best Regards,
    Todor

    jQWidgets Team
    https://www.jqwidgets.com

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

You must be logged in to reply to this topic.