Question

I'm using Dynatree version $Version: 1.2.2$. I use the node.reloadChildren(); call after a call to a $.ajax function that has populated the database that represents the tree. The problem is right after the call to node.reloadChildren(); the new leafs added to the node added do not show up in the tree. No errors/exceptions are thrown. I can tell that the .ajax function worked because when I refresh the whole page then the nodes show up. This is not a issue In Chrome. I'm using the latest version of FireFox (21.0) and IE 10. This is a intermittent issue and sometimes it just works.

Thanks

... ...

ajxAddNewCatalogProduct(products, node); node.reloadChildren();

... ... ...

function ajxAddNewCatalogProduct(products, node) {
    $.ajax({
        type: "POST",
        url: '@Url.Action("ActionCode")',
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        data: "{'products': '" + products + "', 'portalId': '" + portalId + "', 'nodeId': '" + node.data.key + "', 'nodeType': '" + node.data.Type + "'}"
    });
}
Was it helpful?

Solution

ajxAddNewCatalogProduct(products, node); starts an asynchronous request and may return before it is processed.

Try to call node.reloadChildren(); in the success callback of your ajax call.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top