Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by ray on May 18, 2009 20:49
open dhtmlx forum
Refreshing Icon in Treegrid after updateFromXML

I have a treegrid that is being updated using updateFromXML.Based on an option selected by a user, an icon is display and the path to the icon is writen in the XML file. The text is being updated but the custom icon is not updating unless I refresh the page. If I use clearAll() and then loadXML(URL), the icon updates with the correct one. How can I get the icon to refresh using updateFromXML without having to refresh the entire page?
Answer posted by Support on May 19, 2009 06:11
How big is treegrid in your case?
For relative small treegrids, next code can be used

treegrid.updateFromXML(url, insert_new, del_missed, function(){
   //after loading
   treegrid._h2.forEachChild(0,function(el){
          var cell = treegrid.cells(el.id,INDEX);
          cell.setImage(cell.getAttribute("image"));
   });
})
Answer posted by ray on May 19, 2009 08:41
That works but for some reason it is placing a / and therefore the image is not displaying. It looks lik this dthmlx/img//imagename.png.
How do I remove the second / ?
Answer posted by Support on May 20, 2009 05:46
The path to image set as 
  image_folder_path + value 

So if you have ending "/" in image path, the value of image attribute must be just image name , without starting "/"

if image path ( set by setImagePath or setIconPath ) and image name set correctly, but unwanted "/" still occurs - please provide info , which version of dhtmlxTreeGrid you are using?

Answer posted by ray on May 20, 2009 06:59

The image path is set correctly.

treeGrid.setImagePath("dhtmlx/imgs/");

The name is coming back as

"image1.png"

But it is displaying as dhtmlx/imgs//image1.png.

I am using dhtmlxTreeGrid v.1.6 build 80512.

Answer posted by Support on May 20, 2009 08:41
The issue not occurs with latest codebase for sure. 
Updated js file for dhtmlxTreeGrid v.1.6 build 80512 sent by email, please try to use it instead of original one.

Answer posted by ray on May 20, 2009 11:29
That work! Thank you! In the version I had, it has "/" which was causing the // issue.