Archive for March, 2008

Change cursor style to hand

Written by coregps on Wednesday, March 19th, 2008 in Web Design.

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

You might want to change the default cursor of an html element to hand. For example, an img element, something like this:

<img src=”button.gif” style=”cursor: hand” />

This works well in IE, but in Firefox, it has no effect. The correct css style should be:

<img src=”button.gif” style=”cursor: pointer” />

It works both in IE and Firefox.

How to solve XML reffers to not existing parent error of dhtmlxTree

Written by coregps on Thursday, March 13th, 2008 in Java, AJAX, XML.

When I use dhtmlxTree dynamical loading with jsp, I always get the following exception:

Error type: DataStructure
Description: XML reffers to not existing parent

The code of the jsp page is as following:

<html>
<head>
</head>
<body>
    <link rel="STYLESHEET" type="text/css" href="css/dhtmlxtree.css">
    <script  src="js/dhtmlxcommon.js"></script>
    <script  src="js/dhtmlxtree.js"></script>
    <div id="treeboxbox_tree" style="width:100%; height:218;background-color:#f5f5f5;border :1px solid Silver;; overflow:auto;"></div>
    <script type="text/javascript">
		tree=new dhtmlXTreeObject("treeboxbox_tree","100%","100%",0);
		tree.attachEvent("onClick",onNodeSelect);
		tree.setImagePath("images/tree/");
		tree.setXMLAutoLoading("AdminFolderServlet?action=folder_treeview");
		tree.loadXML("AdminFolderServlet?action=folder_treeview&id=1");
		function onNodeSelect(nodeId){
		    document.getElementById("parent_folder_id").value = nodeId;
		}
    </script>
</body>
</html>

And the following is the code snippet used to generate XML file of the tree:

String id = request.getParameter("id");
if (id == null) id = "1";
Vector folders = Folder.getFolders(Integer.parseInt(id));
StringBuffer buff = new StringBuffer("< ?xml version=\"1.0\"?>“);
buff.append(”
“);
for (int i = 0; i < folders.size(); i++) {
	Folder f = (Folder)folders.get(i);
	buff.append("“);
}
buff.append(”“);
response.setContentType(”text/xml”);
response.setHeader(”Cache-Control”,”no-cache”); //HTTP 1.1
response.setHeader(”Pragma”,”no-cache”); //HTTP 1.0
response.setDateHeader(”Expires”, 0); //prevents caching at the proxy server
response.getWriter().write(buff.toString());

The generated XML is well formed.

<?xml version="1.0"?>
<tree id='1'>
	<item child='1' id='2' text='Games' im0='folderClosed.gif' im1='folderOpen.gif' im2='folderClosed.gif'></item>
	<item child='1' id='3' text='Music' im0='folderClosed.gif' im1='folderOpen.gif' im2='folderClosed.gif'></item>
	<item child='0' id='4' text='Books' im0='folderClosed.gif' im1='folderOpen.gif' im2='folderClosed.gif'></item>
	<item child='1' id='5' text='Movies' im0='folderClosed.gif' im1='folderOpen.gif' im2='folderClosed.gif'></item>
	<item child='1' id='6' text='Photos' im0='folderClosed.gif' im1='folderOpen.gif' im2='folderClosed.gif'></item>
	<item child='0' id='14' text='Articles' im0='folderClosed.gif' im1='folderOpen.gif' im2='folderClosed.gif'></item>
</tree>

I finally found the solution. The id attribute of the tree element must point to the parent id, which data will be linked, by default super-root ID = 0, but it can be changed while tree initialization ( 4th parameter of constructor ), In case of dynamic loading the tree id must be equal to the parent ID for which data requested.

In my database, the root id of the top level folder is 1, however, I use 0 in the tree initialization method.

tree=new dhtmlXTreeObject("treeboxbox_tree","100%","100%",0);

So, I got the exception. After changing the fourth parameter to 1, it works well.

tree=new dhtmlXTreeObject("treeboxbox_tree","100%","100%",1);

Hope this can help someone else in the future :)

propecia pricebuy propeciaorder ventolinbuy ventolincheap xenicalxenical onlneorder revatiorevatiofemale viagra onlinefemale viagracompare viagra cialisorder viagra cialischeap vpxlvpxl onlineorder levitra professionallevitra professional onlinebuy levitra prescriptionlevitralevitra onlineorder cialis jellycialis jellyorder cialis soft tabsbuy cialis soft tabsorder cialis super activecheap cialis super activeorder generic cialischeap generic cialiscialis professionalcialis professional onlinepurchase cialiscialis pricecialischeap brand viagrabrand viagra onlineviagra jelly onlineviagra jelly priceorder viagra soft tabsbuy viagra soft tabsviagra super active onlineviagra super activeorder generic viagracheap generic viagraviagra professional onlineviagra professionalpurchase viagraviagracheap viagraorder vpxlbuy vpxltake viagra cialis togetherorder viagra cialis onlinelevitra professional pricecheap levitra professionallevitrabuy levitracialis jelly pricecheap cialis jellycialis soft tabscialis soft tabs onlineorder cialis super activecialis super activeorder generic cialischeap generic cialischeap cialis professionalcialis professional priceorder cialischeap cialischeap brand viagrabrand viagra onlineorder viagra jellyviagra jelly pricecheap viagra tabsviagra soft tabs onlineviagra super active onlinecheapviagra super activegeneric viagrageneric viagra onlineorder viagra professionalcheap viagra professionalviagra pricebuy viagrabuy cialis ukwhat is cialiscialis sale ukpurchase generic cialisbuy cialis money orderbuy cialis low costbuy cialis in ukbuy cialis huge discounts onlinebuy cialis from usa onlinebuy cialis fedex shippingorder cialis and viagrabuy cialis no prescriptionbuy cialis amexbuy cialis by mailbest cialis pricesorder viagra international shipscheapest place to buy viagra onlineviagra purchasebuy taladafil viagraviagra mail order ukviagra low pricecheap site buy viagrabuy generic viagra canadaviagra drugs order brand pillviagra best quality lowest priceshow to buy viagra onlinebuy viagra online securelybuy viagra online pharmacybuy viagra online get prescriptionbest way to take levitrabest price viagra or levitrabest price viagra official drug storeorder viagra with master cardorder viagra upsbuy viagra in englandbuy viagra consumers discount


Site Navigation