Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » tree - ajax problem

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 1273 Views
  • trabik
    Avatar
    1 Post

    tree - ajax problem Link to this post

    Hi, can anybody help me with my problem please? On my site I used tree javascript utility to generate tree list of items. But there are many items so I need load them from DB with ajax. But if i do this (load some data and then build new list <ul id='tree'>..... ) this script doesn't work.. Maybe it must be refreshed after rebuild ul with JS DOM operations?? But how can I do it? If I generate <ul> with JS and not after ajax it works. Thanks a lot!
    this is sample code:
    function handle(xhr, json) // ajax handle function
    {
    var tree = document.getElementById('treediv'); // this three lines don't work here
    tree.innerHTML = "<ul class='tree'>....   "; // (tree is generated but no 'recognized'
    appendLoader(autoInit_trees); // => there are not +- buttons, folder icons etc..
    }

    function getData(par) // make ajax request
    {
    var myAjax = new Ajax.Request('../getMarques',
    {method: 'get', parameters: { ... },
    onComplete: handle});
    // but if I put them (=three lines) here it's ok .... but I must use ajax to load data, how? ((
    }

    1273 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.