Dynamically update a label inside toolbar

Hi,

I’m trying to update dynamically a label which is embed in a toolbar component that is composed by the following structure:

{ 	
											view:"toolbar",
											id:"nav_path",
											type:"SubBar",
											data:[
												{ 
													type:"label", 
													label:"Enterprise", 
													align:"left" 
												}
											]
										}

Using this:

var obj_tabbar = new Object(); obj_tabbar.type = "label"; obj_tabbar.label = "My Update"; obj_tabbar.id = "nav_path2"; obj_tabbar.align = "left"; $$("nav_path").refresh();

However, i’m getting the following error:

XML filter is applied to non-XML value (function (a, b) {if (typeof a == “object”) {return this.Oc(a);}return this.ic(a, b);})

I’d appreciate any help.

Thanks,

Pipe

I forgot this line

$$("nav_path").define.("data",obj_tabbar);

Any clue?

change your code as

$$(“nav_path”).define.(“data”,[obj_tabbar]);

data is an array of objects, not a single object
by the way it will add the new button, if you want to remove old one - use comp.clearAll() before setting new data.

Thanks, I did what you suggested, however I’m still getting the same error.

var obj_tabbar = new Object(); obj_tabbar.type = "label"; obj_tabbar.label = "Something"; obj_tabbar.id = "nav_path2"; obj_tabbar.align = "left"; $$("nav_path").clearAll(); $$("nav_path").define.("data",[obj_tabbar]); $$("nav_path").refresh();

Error caught from Firebug at $$(“nav_path”).define.(“data”,[obj_tabbar]);

XML filter is applied to non-XML value (function (a, b) {if (typeof a == “object”) {return this.Oc(a);}return this.ic(a, b);})

Am I doing something wrong? For me all seems to be alright, any clue?

Thanks,

Pipe

Check the attached sample.

Most probably you problem will be resolved after adding datatype:json to the toolbar’s config.

			dhx.ui({    
                                 view:"toolbar",
                                 id:"nav_path",
                                 datatype:"json",

touch1403.zip (73.5 KB)