Hi,
I am using tree, in that I need to implement the sorting functionality.
So I have added the sorting tool button in content panel header and after selection of that button I am sorting the tree.
But its not working.
See the below code:

Code:
import com.demo.gxt.client.resource.TestData;
import com.demo.gxt.client.resource.images.ExampleImages;
import com.demo.gxt.client.resource.model.BaseDto;
import com.demo.gxt.client.resource.model.FolderDto;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
import com.sencha.gxt.core.client.ValueProvider;
import com.sencha.gxt.data.shared.ModelKeyProvider;
import com.sencha.gxt.data.shared.SortDir;
import com.sencha.gxt.data.shared.TreeStore;
import com.sencha.gxt.widget.core.client.ContentPanel;
import com.sencha.gxt.widget.core.client.button.TextButton;
import com.sencha.gxt.widget.core.client.event.SelectEvent;
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
import com.sencha.gxt.widget.core.client.tree.Tree;


public class BasicTreeExample implements IsWidget, EntryPoint {


	class KeyProvider implements ModelKeyProvider<BaseDto> {
		@Override
		public String getKey(BaseDto item) {
			return (item instanceof FolderDto ? "f-" : "m-")
					+ item.getId().toString();
		}
	}


	@Override
	public Widget asWidget() {
		ContentPanel con = new ContentPanel();
		con.addStyleName("margin-10");


		final TreeStore<BaseDto> store = new TreeStore<BaseDto>(
				new KeyProvider());


		FolderDto root = TestData.getMusicRootFolder();
		for (BaseDto base : root.getChildren()) {
			store.add(base);
			if (base instanceof FolderDto) {
				processFolder(store, (FolderDto) base);
			}
		}


		final Tree<BaseDto, String> tree = new Tree<BaseDto, String>(store,
				new ValueProvider<BaseDto, String>() {


					@Override
					public String getValue(BaseDto object) {
						return object.getName();
					}


					@Override
					public void setValue(BaseDto object, String value) {
					}


					@Override
					public String getPath() {
						return "name";
					}
				});
		con.setWidth(300);


		con.add(tree);
		TextButton sortButton = new TextButton("",
				ExampleImages.INSTANCE.sortIcon());
		sortButton.addSelectHandler(new SelectHandler() {


			@Override
			public void onSelect(SelectEvent event) {
				SortDir sortDir = SortDir.DESC;
				if (store.getSortInfo().size() > 0) {
					sortDir = store.getSortInfo().get(0).getDirection();
					if (sortDir.equals(SortDir.ASC)) {
						sortDir = SortDir.DESC;
					} else {
						sortDir = SortDir.ASC;
					}
				}
				store.applySort(false);


			}
		});


		sortButton.setToolTip("Sorting");
		con.getHeader().addTool(sortButton);
		return con;
	}


	public void onModuleLoad() {
		RootPanel.get().add(asWidget());
	}


	private void processFolder(TreeStore<BaseDto> store, FolderDto folder) {
		for (BaseDto child : folder.getChildren()) {
			store.add(folder, child);
			if (child instanceof FolderDto) {
				processFolder(store, (FolderDto) child);
			}
		}
	}
}
Regards,
Subendu