これは昨日問題なく動作していました。ただし、今朝ワークステーションを離れてから戻ってから、コードに明らかな変更を特定できません。
JsonAction オブジェクトを返し、パラメーター (HttpGet) を受け入れない ASP.NET MVC 5 コントローラー メソッドがあります。私はそのリターンをテストしましたが、適切な JSON を返しています。この問題がなかった昨日と同じ構造です。これは、サーバー側での可能性を排除しているようです。
dataBind の呼び出しでは、次のような URL を使用しています。
/Home/GetAllUsersJSON?pk=userid&_=1413996086894
Chrome で調べると、igGrid のクライアント API が dataBind() 中に dataSourceURL の末尾にクエリ文字列を追加している (または追加しようとしている) ことが原因のようです。関連するデータベーステーブルのいずれかで、2番目のパラメーターの値(これも名前がなく、一見アンダースコア文字にすぎません)を特定することさえできません(つまり、その値がどこから来たのかわかりません)--ただし、デバッグを試行するたびに変更されません。
クライアント側 (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');
});