jQWidgets Forums

jQuery UI Widgets Forums TreeGrid couldn't display parentDataField properly

This topic contains 3 replies, has 2 voices, and was last updated by  Peter Stoev 11 years, 1 month ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • couldn't display parentDataField properly #49417

    jzhong
    Participant

    hierarchy:
    {
    keyDataField: { name: ‘child’ },
    parentDataField: { name: ‘parent’ }
    },

    addButton.click(function (event) {
    if (!addButton.jqxButton(‘disabled’)) {
    $(“#treeGrid”).jqxTreeGrid(‘expandRow’, rowKey);
    // add new empty row.
    $(“#treeGrid”).jqxTreeGrid(‘addRow’, newRowID, {‘child’:’2.8′,’parent’:[rowKey],’link’:0,’score’:0}, ‘last’, rowKey);

    // select the first row and clear the selection.
    $(“#treeGrid”).jqxTreeGrid(‘clearSelection’);
    $(“#treeGrid”).jqxTreeGrid(‘selectRow’, newRowID);
    // edit the new row.
    $(“#treeGrid”).jqxTreeGrid(‘beginRowEdit’, newRowID);
    updateButtons(‘add’);
    }
    });

    It shows Child:2.8 Parent:[object Object] link:0 score:0 on the page.

    couldn't display parentDataField properly #49434

    Peter Stoev
    Keymaster

    Hi jzhong,

    It is not possible to update a Parent Field when you add a Row in jqxTreeGrid. The Rows also do not have such thing as parentDataField. That is used only during the data biding.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    couldn't display parentDataField properly #49477

    jzhong
    Participant

    Thanks for your feedback Peter.

    I was thinking that there should be a way to set a ParentDataField since there is a way to set keyDataField.

    But showing “[object Object]” at the parentField isn’t user friendly.

    Is there a way to work around?

    couldn't display parentDataField properly #49479

    Peter Stoev
    Keymaster

    Hi jzhong,

    When you call the “addRow” method, you actually add the new record as a child of existing record i.e its parentDataField is automatically updated by jqxTreeGrid.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.