首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >igGrid "404找不到“在dataSourceURL上

igGrid "404找不到“在dataSourceURL上
EN

Stack Overflow用户
提问于 2014-10-22 17:03:53
回答 1查看 332关注 0票数 0

昨天这件事没出问题。但是,自从今天早上离开并返回到我的工作站后,我无法识别代码中的任何明显更改。

我有一个ASP.NET MVC 5控制器方法,它返回一个JsonAction对象,并且不接受任何参数(HttpGet)。我已经测试了它的返回,它正在返回正确的JSON--与昨天没有这个问题时的结构相同。这似乎排除了服务器端的任何可能性。

对dataBind的调用使用如下所示的URL:

/Home/GetAllUsersJSON?pk=userid&_=1413996086894

原因似乎是,从Chrome的角度来看,igGrid的客户机API似乎是在dataSourceURL ()期间向dataBind()的末尾追加(或试图添加)查询字符串。我甚至无法识别任何相关数据库表中的第二个参数的值(该参数也是匿名的,似乎只是一个下划线字符)(换句话说,我不知道该值来自何处)--然而,在每次调试尝试中,它确实保持不变。

我只使用客户端(JS)来呈现和操作igGrid。这是代码:

代码语言:javascript
复制
$(document).ready(function () {
    $('#usersgrid').igGrid({
        autoGenerateColumns: false,
        columns:    [
            { headerText: 'userid', key: 'userid', dataType: 'number' },
            { headerText: 'username', key: 'username', dataType: 'string' },
            { headerText: 'login', key: 'loginid', dataType: 'string' },
            { headerText: 'role', key: 'role', dataType: 'string' },
            { headerText: 'distributor', key: 'distributorid', dataType: 'number' },
            { headerText: 'inactive', key: 'inactive', dataType: 'boolean' },
            { headerText: 'lastupdated', key: 'lastupdated', dataType: 'date', format: 'dateTime' }
        ],
        dataSourceUrl: '/Home/GetAllUsersJSON',
        primaryKey: 'userid',
        features: [{
            name: 'Updating',
            enableAddRow: true,
            enableDeleteRow: true,
            columnSettings: [{
                columnKey: 'userid',
                editorOptions: { readonly: true, disabled: true }
            }, {
                columnKey: 'username',
                editorType: 'string',
                validation: true,
                editorOptions: { required: true }
            }, {
                columnKey: 'loginid',
                editorOptions: { readonly: true, disabled: true }
            }, {
                columnKey: 'role',
                editorType: 'string',
                validation: true,
                editorOptions: { required: true }
            }, {
                columnKey: 'distributorid',
                editorType: 'numeric',
                validation: true,
                editorOptions: { button: 'spin', minValue: 0, maxValue: 2000000, required: true }
            }, {
                columnKey: 'inactive',
                editorType: 'combo',
                editorOptions: {
                    mode: 'dropdown',
                    required: true,
                    dataSource: trueFalseValues,
                    textKey: 'text',
                    valueKey: 'value'
                }
            }, {
                columnKey: 'lastupdated',
                editorOptions: { readonly: true, disabled: true }
            }]
        } ]
    }).igGrid('dataBind');
});
EN

回答 1

Stack Overflow用户

发布于 2014-11-13 09:09:27

使用dataSource选项而不是dataSourceUrldataSourceUrl用于MVC中的按需加载场景,而不是用于初始数据绑定。可以将远程url作为dataSource选项值传递。您看到的参数是主键字段的名称和jsonp请求完成时要执行的回调。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26513049

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档