您的位置:首页 > 产品设计 > UI/UE

easyui treegrid的使用示例

2015-06-23 15:10 483 查看
一、前端:

public ActionResult MenuIndex(FormCollection form)
{
//取从数据字典中取中Menu对应的ID号
var dic = _dictionaryService.Single(o => o.Name == "MENU" && o.IsDeleted == false);
var menuId = dic.Id;

//查询所有菜单信息
var menus = _actionService.Where(o => o.IsDeleted == false && o.OperationType == menuId && o.IsShow == true, o => o.DisOrder, true, "FormMethodDictionary", "OperationTypeDictionary").ToList();

//构造TreeGrid的数据
RSCC.Model.PageData<ActionViewModel> treegrids = new RSCC.Model.PageData<ActionViewModel>();
treegrids.total = menus.Count();
treegrids.rows = menus.Select(o => o.ToViewModel()).ToList();

//转化为JSON格式
var strJson = operationContext.ToJson(treegrids);
return Content(strJson);

}


View Code
三、注意事项:

对应的ViewModel中必须有 _parentId 和 state 属性,iconCls 可选。

四、实现效果如下:



  
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: