Question

I'm searching for some ready-made solution for working with nested sets with PHP and jQuery.

I know about nested sets and I know how to work with PHP and jQuery but I want to save my time using ready-made solution.

What is the best solution?

Était-ce utile?

La solution

a solution to handle nested sets (or any other data structure) would be json_encode/json_decode

Send data from PHP to JavaScript:

$data = new PHPComplexData();
echo json_encode($data);


Receive data in client side:

$.get('data.php', function(data){
    var jsData = eval('('+data+')');
    //You have a JavaScript object
});


Send data from JavaScript to PHP

var jsData = new JSComplexData();
$.post('data.php', {data:$.toJSON(jsData)});


Receive data in server side

$data = json_decode($_POST['data']);


you need jquery-json plugin to use $.toJSON function

Autres conseils

Your question is quite hard to understand, but if I'm reading you right, you're looking for some kind of jQuery treeview control?

Maybe something like this: http://www.dynamicdrive.com/dynamicindex1/treeview/index.htm

or this: http://be.twixt.us/jquery/treeViewCollapsed.php

or any number of others....?

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top