首页 新闻 会员 周边 捐助

求指教,一个mvc4 和easyui的问题

0
悬赏园豆:5 [已解决问题] 解决于 2013-07-22 13:26

我在布局页面里引入了样式和js

@Styles.Render("~/EasyUI/themes/default/easyui.css")
@Styles.Render("~/EasyUI/themes/icon.css")
@Scripts.Render("~/EasyUI/jquery-1.7.2.min.js")
@Scripts.Render("~/EasyUI/jquery.easyui.min.js")
@Scripts.Render("~/EasyUI/locale/easyui-lang-zh_CN.js")

控制器里面的方法是:

//
// GET: /Admins/
public JsonResult Index()
{
     List<Admins> list = db.adminList.ToList();
     var date = new { total = list.Count, rows = (list) };
     return Json(date, JsonRequestBehavior.AllowGet);
}

返回给页面的json数据是:

{"total":5,"rows":[{"ID":2,"Account":"aaa","PWD":"111","Name":null,"Tel":null,"Email":null,"Introduce":null,"Rank":null,"Rights":null,"Created":"\/Date(1373817600000)\/","Enabled":0,"ChannelStr":null,"ColumnStr":null},{"ID":3,"Account":"bbb","PWD":"222","Name":null,"Tel":null,"Email":null,"Introduce":null,"Rank":null,"Rights":null,"Created":"\/Date(1373817600000)\/","Enabled":0,"ChannelStr":null,"ColumnStr":null},{"ID":4,"Account":"ccc","PWD":"333","Name":null,"Tel":null,"Email":null,"Introduce":null,"Rank":null,"Rights":null,"Created":"\/Date(1373817600000)\/","Enabled":0,"ChannelStr":null,"ColumnStr":null},{"ID":5,"Account":"ddd","PWD":"444","Name":null,"Tel":null,"Email":null,"Introduce":null,"Rank":null,"Rights":null,"Created":"\/Date(1373817600000)\/","Enabled":0,"ChannelStr":null,"ColumnStr":null},{"ID":6,"Account":"eee","PWD":"555","Name":null,"Tel":null,"Email":null,"Introduce":null,"Rank":null,"Rights":null,"Created":"\/Date(1373817600000)\/","Enabled":0,"ChannelStr":null,"ColumnStr":null}]}

在视图中的用easyui绑定这些数据,居然绑定不出来。

<table id="list"></table>
<script type="text/javascript">
$(function () {
  $('#list').datagrid({
    url: 'Admins/Index',//控制器/方法
    columns: [[
      { field: 'Account', title: '帐号', width: 100 },
      { field: 'PWD', title: '密码', width: 100 },
      { field: 'Created', title: '创建时间', width: 100, align: 'right' }
    ]]
  });
});
</script>


绑定失败了,看到的页面是,上面那一堆json数据,为什么会这样呢?
iisp的主页 iisp | 初学一级 | 园豆:81
提问于:2013-07-18 23:00
< >
分享
最佳答案
0

Json数据源先使用最简单的字段,不要弄得那么多字段,把日期先去掉试试,然后一个一个试。看起来没有什么问题,具体你需要慢慢去调试。

收获园豆:5
F2BPM工作流 | 菜鸟二级 |园豆:209 | 2013-07-19 10:02

控制器需要什么 [] 修饰么?

iisp | 园豆:81 (初学一级) | 2013-07-20 11:14

我觉得不是代码的问题了,是不是环境的问题啊?

iisp | 园豆:81 (初学一级) | 2013-07-20 12:24
其他回答(2)
0

貌似没啥问题额,换个jquery版本呢?

db丶 | 园豆:195 (初学一级) | 2013-07-19 09:32
0

columns获取列有问题 

s_p | 园豆:140 (初学一级) | 2013-07-19 09:33

什么问题?愿闻其详

支持(0) 反对(0) iisp | 园豆:81 (初学一级) | 2013-07-19 14:09
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册