View Full Version : Trouble initialize tbar dynamically

10 Sep 2010, 1:54 AM
I'm having some (for me) odd difficulties to initialize a the tbar-config in a gridpanel.
If I initialize the tbar static, aka:
tbar : [ { ... }] it works swell.

But If I use a global variable somewhere else:
var tBar = "[{ ... }]";

and then later on in my extJs do like this:
tbar: tBar
The tbar is just treated as a string, or in other words, when I later do an alert, it will just print
a plain string. Whereas the static initialization would give something like {Object Object}, {Object Object}, ...

Any suggestions why this happen and what to do?

Ole Christian

10 Sep 2010, 2:11 AM

var tBar = [{ ... }];
and not

var tBar = "[{ ... }]";

10 Sep 2010, 2:36 AM
Hi Condor!
Thanks for your reply.
I initially tried that, but the error I got from had nothing to about the structure (I realize now) but from an unknown handler.
This however will be easily solved.
Thanks again!

Ole Christian