jsTree – načtení json dat z presenteru
Upozornění: Tohle vlákno je hodně staré a informace nemusí být platné pro současné Nette.

- Juve
 - Člen | 27
 
Ahoj,
potřeboval bych načíst při inicializaci jstree stromu data z presenteru,
nevím ale jak tento kod přepsat v rámci nette aplikace:
<script>
"json_data" : {
    // This tree is ajax enabled - as this is most common, and maybe a bit more complex
    // All the options are almost the same as jQuery's AJAX (read the docs)
    "ajax" : {
        // the URL to fetch the data
        "url" : "./server.php",
        // the `data` function is executed in the instance's scope
        // the parameter n is the node being loaded
        // (may be -1, 0, or undefined when loading the root nodes)
        "data" : function (n) {
            // the result is fed to the AJAX request `data` option
            return {
                    "operation" : "get_children",
                    "id" : n.attr ? n.attr("id").replace("node_","") : 1
            };
        }
    }
}
</script>
je mi jasné, že řádek „url“ : „./server.php“ určuje soubor, z kterého data budou čerpána a function(n) zase předává souboru server.php v poli $_REQUEST parametry „operation“ a „id“, jak to mam ale přepsat, pokud chci aby byly parametry předány nějaké metodě presenteru a ten nasledne ajaxově odpověděl a odeslal data?
Děkuji za pomoc