setItemText is not working

Hello,

we are having an application where i want to retain value of buttonSelect of a toolbar after an ajax call.But unfortunately, setItemText is not working for me.

Following is toolbar.xml—

[code]

[/code]

Here is javascript function—

var filterSelected = document.getElementById('filterSelected').value; //filterSelected is hidden field which contains selected Option
alert(filterSelected); //works

myGrid.clearAndLoad("servletName?option="+filterSelected, function{layout.cells("b").progressOff();}, "xml");

parentGridToolbar.clearAll();
parentGridToolbar.loadStruct("toolbar.xml", null);

if (filterSelected == "opt1"){
parentGridToolbar.setItemText("lnkFilterGrid","Filter Grid By : <B>Option 1</B>");
}else if(filterSelected == "opt2"){
parentGridToolbar.setItemText("lnkFilterGrid","Filter Grid By : <B>Option 2</B>");

}else if(filterSelected == "opt3"){
parentGridToolbar.setItemText("lnkFilterGrid","Filter Grid By : <B>Option 3</B>");
}
console.log(parentGridToolbar.getItemText("lnkFilterGrid"));
}

I am calling this function after successful call of ajax.Please Suggest what can be the problem

Hello
You can try to call this method in callback of loadStruct function