昨天这件事没出问题。但是,自从今天早上离开并返回到我的工作站后,我无法识别代码中的任何明显更改。
我有一个ASP.NET MVC 5控制器方法,它返回一个JsonAction对象,并且不接受任何参数(HttpGet)。我已经测试了它的返回,它正在返回正确的JSON--与昨天没有这个问题时的结构相同。这似乎排除了服务器端的任何可能性。
对dataBind的调用使用如下所示的URL:
/Home/GetAllUsersJSON?pk=userid&_=1413996086894
原因似乎是,从Chrome的角度来看,igGrid的客户机API似乎是在dataSourceURL ()期间向dataBind()的末尾追加(或试图添加)查询字符串。我甚至无法识别任何相关数据库表中的第二个参数的值(该参数也是匿名的,似乎只是一个下划线字符)(换句话说,我不知道该值来自何处)--然而,在每次调试尝试中,它确实保持不变。
我只使用客户端(JS)来呈现和操作igGrid。这是代码:
$(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');
});发布于 2014-11-13 09:09:27
使用dataSource选项而不是dataSourceUrl。dataSourceUrl用于MVC中的按需加载场景,而不是用于初始数据绑定。可以将远程url作为dataSource选项值传递。您看到的参数是主键字段的名称和jsonp请求完成时要执行的回调。
https://stackoverflow.com/questions/26513049
复制相似问题