easyUI的formmatter使用

 <th data-options="field:'cid',width:100,formatter:findName">叶子类目</th>
function findName(value){
    $.ajax({
        url:"/rest/item/cat/cid",
        data:{"cid":value},
        ContentType:'application/json',
        success:function(rtn){
            //alert(rtn.name);
            return rtn.name;
        }
    });
}
页面不显示数据

第一,你的return是success回调的返回值,不是findName的

第二,你ajax异步的,要改为同步


    function findName(value) {
        var r = null;//////////
        $.ajax({
            url: "/rest/item/cat/cid",
            async: false,//////////
            data: { "cid": value },
            ContentType: 'application/json',
            success: function (rtn) {
                r = rtn.name;//////////
            }
        });

        return r;//////////
    }

异步为什么不可以?我按你这样写了还是没值