0

I have a problem with sencha gxt 3.0. Is it possible to bold some items on the tree? If the answer is yes, how can I do it?

piechos
  • 123
  • 2
  • 10
  • add a proper css and then use below info : http://stackoverflow.com/questions/10632458/how-to-add-css-to-selected-row-in-treegrid-gxt-3 – bgth Feb 23 '15 at 12:23
  • Thanks I will try if I won't find another way, but for now I would preffer to do it without using css. Is it possible? – piechos Feb 23 '15 at 12:28
  • You can do it by setting it on the cell using override of render method, but you will not be having the grid object to check for condition there and hence will not be applicable only for some tree objects. valueColumn.setCell(new AbstractCell(){ @Override public void render(Context context, String valueString, SafeHtmlBuilder sb) { if (context.getKey()!=null && !context.getKey().equals("null") && valueString!=null && valueString.trim().length() > 0 ){ sb.appendHtmlConstant("" + valueString + "" } } }); – bgth Feb 23 '15 at 12:40
  • these solutions seems to be for the TreeGrid, but I'm using just normal Tree component – piechos Feb 23 '15 at 13:31

1 Answers1

0

I resolved it that way:

final List<String> keys = getFilteredList();
filteringTree.getTree().setCell(new AbstractCell<String>() {
            @Override
            public void render(Context context, String valueString,
                    SafeHtmlBuilder sb) {
                Object key = context.getKey();
                System.out.println(keys.contains(key));
                if (context.getKey() != null
                        && !context.getKey().equals("null")
                        && valueString != null
                        && valueString.trim().length() > 0
                        && keys.contains(key)) {
                    sb.appendHtmlConstant("<b>" + valueString + "</b>");
                } else {
                    sb.appendHtmlConstant(valueString);
                }
            }

where getFilteredList() gets the list of elements which fit to the filter

Thanks bgth ;)

piechos
  • 123
  • 2
  • 10