【发布时间】:2014-10-22 17:03:53
【问题描述】:
这个昨天工作没有问题。但是,自从今天早上离开并返回我的工作站后,我无法发现我的代码有任何明显的变化。
我有一个 ASP.NET MVC 5 控制器方法,它返回一个 JsonAction 对象,并且不接受任何参数 (HttpGet)。我已经测试了它的返回,它返回了正确的 JSON——与昨天我没有这个问题时的结构相同。这似乎排除了服务器端的任何可能性。
对 dataBind 的调用使用如下所示的 URL:
/Home/GetAllUsersJSON?pk=userid&_=1413996086894
根据在 Chrome 中的检查,原因似乎是 igGrid 的客户端 API 在 dataBind() 期间似乎正在将查询字符串附加(或尝试附加)到 dataSourceURL 的末尾。我什至无法识别任何相关数据库表中的第二个参数(也是无名的,似乎只是一个下划线字符)的值(换句话说,我不知道该值来自何处)--但是,它在每次调试尝试中都保持不变。
我只使用客户端 (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');
});
【问题讨论】:
标签: jquery asp.net-mvc infragistics ignite-ui iggrid