Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

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

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

tree - ajax problem


Go to End


1685 Views

Avatar
trabik

1 Post

10 September 2007 at 12:58am

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? :(((
}