背景: 53x 列の jQuery Datatable があります。最初の列はユーザー名で、編集できません。次の 52 列は 1 年の週を表し、それぞれを編集可能にする必要があります。それらにはすべて、まったく同じオプションが含まれています。
問題:列データを 52 回「コピー&ペースト」することなく、52 週間すべてを定義するより良い方法はありますか?
私のコード:
$(document).ready( function () {
$('#example').dataTable().makeEditable({
sUpdateURL: function(value, settings)
{
return(value);
},
"aoColumns": [
null,
{
tooltip: 'Click to change leave',
loadtext: 'loading...',
type: 'select',
onblur: 'cancel',
submit: 'Ok',
data: "{'':'Please select...', 'A':'A','B':'B','C':'C'}",
loadtype: 'GET'
},
{
tooltip: 'Click to change leave',
loadtext: 'loading...',
type: 'select',
onblur: 'cancel',
submit: 'Ok',
data: "{'':'Please select...', 'A':'A','B':'B','C':'C'}",
loadtype: 'GET'
},
{REPEAT 49 more times}
{
tooltip: 'Click to change leave',
loadtext: 'loading...',
type: 'select',
onblur: 'cancel',
submit: 'Ok',
data: "{'':'Please select...', 'A':'A','B':'B','C':'C'}",
loadtype: 'GET'
} ]
});
}))