View Full Version : Dynamic badgeText

29 Nov 2010, 9:04 AM
On my toolbar, I would like to have the badgeText show the number of jobs in a queue. I have created a service which returns a JSON string which only has 1 record in it. I then created a data store reading this JSON string and including the single field 'num_jobs'.

I have tried using the getByID for the data store without success. Can anyone help me with the syntax to pull the single record from the data store and set the badgeText to it? Is the correct approach to use the data store object (I have used it several times when working with ExtJS grids)?

Thanks in advance,

29 Nov 2010, 2:00 PM
If it's just a single item I'd just do an Ajax request, no point setting up a whole store just to read a single value.

Then just use the setBadgeText method.

30 Nov 2010, 1:17 PM
I actually changed my service to return more data and had the summary information in the first record, since I also created a list of all the jobs when selecting the icon showing the badgetext of the job count. I appreciate the reply because I also want to display a gauge and was returning the generated image name in a store but since it is a single item, i am working on changing that to a ajax request.

Thanks again.

9 Sep 2011, 8:13 AM
Hey guys,

I've tried to change a badge text related with my actions and use those commands but does not work.. Is there any way to change badge text?

Here is my simple code:


and error message is

Uncaught TypeError: Object [object Object] has no method 'setBadge'

13 Sep 2011, 1:54 AM
Hi guys,

I've found a solution by reading forums, i use that method and it works:


I wish it helps to others.

13 Sep 2011, 9:48 PM
I think the issue you had there was that your viewCoupon variable was not pointing to the Button/Tab - it must have been something else. tabBar.getComponent(1) works because that's guaranteed to be a Tab...