Exemple #1
0
	else if("type" in options && options.type == "folder") {
		if("additionalParameters" in options && "children" in options.additionalParameters)
			$data = options.additionalParameters.children;
		else $data = {}//no data
	}
	
	if($data != null)//this setTimeout is only for mimicking some random delay
		setTimeout(function(){callback({ data: $data });} , parseInt(Math.random() * 500) + 200);
	//if($data != null) callback({ data: $data });
};
jQuery(document).ready(function($){		
		$('#tochuc-parent-tree').jstree({
		 	"plugins": ["themes", "json_data","checkbox", "ui","types"],
	  		"json_data":{
	  				"data":<?php 
echo TochucHelper::getOneNodeJsTree((int) Core::getManageUnit($user->id));
?>
,
					"ajax" : {
						// the URL to fetch the data
						"url" : "<?php 
echo JUri::root(true);
?>
/api.php?&task=tree&act=TOCHUC",	
						"data" : function(n) {
							return {
								"id" : n.attr ? n.attr("id").replace("node_", "") : <?php 
echo (int) Core::getManageUnit($user->id);
?>
							};
						}
Exemple #2
0
',
			  data:{"id":id},
			  beforeSend: function(){
				  $.blockUI();
				  $('#com_tochuc_viewdetail').empty();				  
				},
			  success: function (data,textStatus,jqXHR){
				  $.unblockUI();
				  $('#com_tochuc_viewdetail').html(data);
			  }
		});	
	};
	var com_jstree = $('#main-content-tree').jstree({
	  		"json_data":{		  		
		  			"data":<?php 
echo TochucHelper::getOneNodeJsTree((int) Core::getManageUnit($user->id, 'com_tochuc', 'tochuc', 'default'));
?>
,				  			
					"ajax" : {
						// the URL to fetch the data
						"url" : "api.php?task=tree&act=tochuc",	
						"data" : function(n) {
							return {
								"id" : n.attr ? n.attr("id").replace("node_", "") : <?php 
echo (int) Core::getManageUnit($user->id, 'com_tochuc', 'tochuc', 'default');
?>
							};
						}
					}
				},
				// Configuring the search plugin