優れた DataTable jQuery プラグインで表示されるテーブル (asp.net で生成) があります。私のテーブルにはいくつかの編集可能なフィールドがあり (私はjQuery Datatables editableを使用しました)、いくつかのテーブルには既にいくつかのカスタム フィールドがあります。
これは、「cell」と「trustedid」という 2 つの追加パラメーター (テーブルの列 3 と 1) を送信する編集可能な列が 3° のみのテーブルです。これは完全に機能します:
$('#ctl00_MainContent_tradGrid').dataTable({
bJQueryUI: true,
"sPaginationType": "full_numbers",
"bSortClasses": false
}).makeEditable({
sUpdateURL: "/updateData.aspx<% Response.Write(parameters); %>",
fnOnEditing: function (input) {
cell = input.parents("tr")
.children("td:nth-child(3)")
.text();
trustedid = input.parents("tr")
.children("td:nth-child(1)")
.text();
return true
},
oUpdateParameters: {
cell: function () { return cell; },
trustedid: function () { return trustedid; }
},
oEditableSettings: { event: 'click' }
});
最後の編集可能な列にチェックボックスがある別のテーブルもあり、これも正常に動作します。これはコードです:
$('#ctl00_MainContent_tradGrid').dataTable({
bJQueryUI: true,
"sPaginationType": "full_numbers",
"bSortClasses": false
}).makeEditable({
sUpdateURL: "/updateChecked.aspx",
aoColumns: [
{}, {}, {}, {
type: 'checkbox',
submit: 'Ok',
cancel: 'Cancel',
checkbox: { trueValue: 'Yes', falseValue: 'No' }
}
]
});
この 2 番目の例では、単一のカスタム パラメータを使用する必要がありますが、それはできません。これは私の試みです:
$('#ctl00_MainContent_tradGrid').dataTable({
bJQueryUI: true,
"sPaginationType": "full_numbers",
"bSortClasses": false
}).makeEditable({
sUpdateURL: "/updateChecked.aspx",
fnOnEditing: function (input) {
trustedid = input.parents("tr")
.children("td:nth-child(1)")
.text();
return true
},
oUpdateParameters: {
trustedid: function () { return trustedid; }
},
aoColumns: [
{}, {}, {}, {
type: 'checkbox',
submit: 'Ok',
cancel: 'Cancel',
checkbox: { trueValue: 'Yes', falseValue: 'No' }
}
]
});
しかし、エラーが発生します:Uncaught ReferenceError: trustedid is not defined
これどうやってするの?