easyUI MVC3一些注意的东东

一、在controller中,传递参数一定要用id来命名

比如:

public JsonResult GetItemsByCategory(string id)    
//一定不能写为
public JsonResult GetItemsByCategory(string category)
//否则,在页面中如果调用此方法    

$('#Unit').combobox({url: '@Url.Action("GetItemsByCategory", "Dic_Item")/'+"单位"});
//就会提示找不到参数的错误

  

二、easyUI combotree只能选择叶节点的代码: 

$('#cc').combotree({            //获取数据URL              url: '@Url.Action("GetGoodsTypeTree", "GoodsType")',            //选择树节点触发事件              onSelect: function (node) {                //返回树对象  var tree = $(this).tree;                //选中的节点是否为叶子节点,如果不是叶子节点,清除选中  var isLeaf = tree('isLeaf', node.target);                if (!isLeaf) {                    //清除选中                      $('#cc').combotree('clear');                }            }        });

三、easyUI tree 只能选叶节点的代码

onBeforeSelect: function (node) {              
//返回树对象
if ($('#tt2').tree('isLeaf', node.target)) {
//清除选中
returntrue;
}
else return false;


}


四、combobox 获取用户输入数据:
     在submit前,
       $('#unit').combobox('setValue', $('#unit').combobox('getText'))

原文地址:https://www.cnblogs.com/zsanhong/p/2736706.html