View Full Version : TreeStore changing icon based on data

5 Jul 2012, 11:39 AM
I am trying to figure out how to change an icon based on the data returned. Data returned has a field "isShared" based on the the value I want to show a different icon for the user. I did some searching but didn't see this question.

I am new to ext js so just not sure how I can do it.

thanks in advance

5 Jul 2012, 8:36 PM
I did it after the tree was rendered using:
record.set('iconCls', 'your-new-icon-class')

6 Jul 2012, 1:14 AM
You can use the icon property also:

icon: 'css/images/record-page.png'

6 Jul 2012, 1:21 AM
Add listener to TreeStore:

beforeappend: function (node, child) {
var me = this;

if (!node) {
// Root node
return true;
if (child.get('isShared')) {
child.set('iconCls', 'you icon class');

return true;

6 Jul 2012, 9:46 AM
Thanks, all the answers were very helpful.