为了账号安全,请及时绑定邮箱和手机立即绑定

json应用于asp.net mvc求解?

json应用于asp.net mvc求解?

泛舟湖上清波郎朗 2018-12-07 05:42:23
$('#test').datagrid({                title: 'My Title',                iconCls: 'icon-save',                width: 600,                height: 350,                nowrap: false,                striped: true,                collapsible: true,                url: '../../Json/datagrid_data.json',                sortName: 'code',                sortOrder: 'desc',                remoteSort: false,                idField: 'code',                frozenColumns: [[                 { field: 'ck', checkbox: true },                 { title: 'code', field: 'code', width: 50, sortable: true }    ]],                columns: [[           { field: 'name', title: 'Name', width: 90 },     { field: 'addr', title: 'Address', width: 90, sortable: true,         sorter: function (a, b) {             return (a > b ? 1 : -1);         }     },     { field: 'col4', title: 'Col41', width: 100 },     { field: 'opt', title: 'Operation', width: 70, align: 'center',         formatter: function (value, rec) {             return '<span style="color:red">Edit Delete</span>';         }     }    ]],                pagination: true,                rownumbers: true,                toolbar: [{                    id: 'btnadd',                    text: 'Add',                    iconCls: 'icon-add',                    handler: function () {                        $('#btnsave').linkbutton('enable');                        alert('add')                    }                }, {                    id: 'btncut',                    text: 'Cut',                    iconCls: 'icon-cut',                    handler: function () {                        $('#btnsave').linkbutton('enable');                        alert('cut')                    }                }, '-', {                    id: 'btnsave',                    text: 'Save',                    disabled: true,                    iconCls: 'icon-save',                    handler: function () {                        $('#btnsave').linkbutton('disable');                        alert('save')                    }                }]            });            var p = $('#test').datagrid('getPager');            if (p) {                $(p).pagination({                    onBeforeRefresh: function () {                        alert('before refresh');                    }                });            }        });   上面一段JS代码,为什么放在MVC里就不能获取'datagrid_data.json'里的值,而把它放到HTML里又能获取'datagrid_data.json'的值,那位高手帮忙解决下,谢谢了!
查看完整描述

1 回答

?
临摹微笑

TA贡献1982条经验 获得超2个赞

路径问题吧,mvc重写了URL的

查看完整回答
反对 回复 2019-01-21
  • 1 回答
  • 0 关注
  • 378 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信