store定义:

Ext.define('permissionStore', {
extend: 'Ext.data.TreeStore',
defaultRootId: ' ',
autoLoad:true,
model: 'permissionModel',
parentIdProperty: 'FartherId',
nodeParam: 'id',
sorters: [{ property: 'OrderNumber', direction: 'ASC' }],
proxy: {
type: 'ajax',
url: '/frame/ListPermission',
actionMethods: { read: 'post' },
reader: {
rootProperty: 'rows',
totalProperty: 'total'

defaultRootId: ’ ‘,是很重要的配置,用来初始化向后台传递的参数,即页面启动时向后台发起的查询参数。
nodeParam: ‘id’,是定义参数名,

后台代码:

public JsonResult ListPermission(string Id)
{
string fartherId = Id.Trim();
fartherId = fartherId == "0" ? null : fartherId;
DataTable dt = new PermissionImpl().GetList(fartherId);
dt.Columns.Add("iconCls");
foreach(DataRow dr in dt.Rows)
{
dr["iconCls"] = dr["icon"];
}
dt.Columns.RemoveAt(dt.Columns.IndexOf("icon"));
return Json(Common.DataGrid(dt));

因为数据库中保存的icon中的值是css样式定义,而extjs中的icon属性是url包含,所以将返回中的icon去掉,加入了iconCls,这样可以的树中显示图标。