How to remove the last node?(dynamic_loading,java connector)


(this is written word by using the English translation)

hi. im lee
There is a problem with the Tree in use . Have any questions .

java


public class tree_02_dynamic_loading_connector extends ConnectorServlet {

	/* (non-Javadoc)
	 * @see com.dhtmlx.connector.ConnectorServlet#configure()
	 */
	@Override
	protected void configure() {
		Connection conn= ( new DataBaseConnection()).getConnection();
		
		TreeConnector c = new TreeConnector(conn,DBType.MSSQL);
		c.dynamic_loading(true);
		c.render_table("tasks", "taskId", "taskName","","parentId");
	}

}

html

tree=new dhtmlXTreeObject("treeboxbox_tree","100%","100%",0);
	tree.setImagePath("../dhtmlx/tree/");
	//tree.enableSmartXMLParsing(true);
	tree.setXMLAutoLoading("02_dynamic_loading_connector.do")
    tree.loadXML("02_dynamic_loading_connector.do");    

image change script ex


tree.attachEvent("onXLE", changeImg);

	function changeImg(tree,id){
		 var subItems = tree.getAllSubItems(id);
		 
		 array_subItems=subItems.split(",");
		 for(var i=0;i<array_subItems.length;i++){
			if(tree.getLevel(array_subItems[i])=="1"){
      		tree.openItem(array_subItems[i]);
      		tree.setItemImage2(array_subItems[i], 'tombs.gif', 'tombs_open.gif', 'tombs.gif');
			}else if(tree.getLevel(array_subItems[i])=="2"){
				tree.setItemImage2(array_subItems[i], 'folderClosed.gif', 'folderOpen.gif', 'folderClosed.gif');
			}else if(tree.getLevel(array_subItems[i])=="3"){
				tree.setItemImage2(array_subItems[i], 'books_close.gif', 'books_open.gif', 'books_close.gif');
			}else if(tree.getLevel(array_subItems[i])=="4"){
				tree.setItemImage2(array_subItems[i], 'leaf.gif', 'leaf.gif', 'leaf.gif');
			}
		 }
	}

I have been using the sample above .
If you click the plus button , the node is expanded .
And , if you click the last node , since there is no node to be added another , plus button disappears .

The contents of the sample up to this point , but if that is one of the nodes of the last from the beginning , I want to be invisible the plus button .
( My data , the last level is always the same , the image , I was converted to the above script )

Conclusion , want to eliminate the plus button to the Tree of the constant level of the last.


Please help me~ ;-(
bye bye~

Hello,

you should set “beforeRender” handler that will mark an item as a branch or a leaf (by default all items are branches). Please see the last article in the following page:

docs.dhtmlx.com/connector__php__dyn_loading.html

And you can apply the following in the 02_dynamic_loading.html demo:

function custom_define($item){ global $tree; $id = $item -> get_id(); $res = $tree->sql->query("select count(*) as count from tasks where parentId={$id}"); $num = $tree->sql->get_next($res); if ($num["count"]) $item->set_kids(true); else $item->set_kids(false); } $tree->event->attach("beforeRender","custom_define");

Sorry, the answer was about PHP connector. Here are docs for Java:

docs.dhtmlx.com/connector__java_ … ading.html