如上图所示,我选择输入为Sub Program
,名称为tblAppendGrid_subprogram_1
,输入下方的输入字段名称为tblAppendGrid_subprogram_2
。
根据上述情况,我想问一下如何将输入字段的名称更改为tblAppendGrid_subprogram[]
以下Appendgrid
的部分代码
$(function() {
$('#tblAppendGrid').appendGrid({
caption: 'Detail Penerimaan dana',
maxRowsAllowed: 3,
initRows: 1,
columns: [
{ name: 'subprogram', display: 'Sub Program', type: 'select',
ctrlOptions:
<?php echo $subprogram;?>
,ctrlAttr: { maxlength: 100 }, ctrlCss: { width: '100%'},ctrlClass: 'form-control' },
{ name: 'sumberdana', display: 'Sumber Dana', type: 'select',
ctrlOptions:
<?php echo $sumberdana;?>
,ctrlAttr: { maxlength: 100 }, ctrlCss: { width: '100%'},ctrlClass: 'form-control' } ,
{ name: 'kategori', display: 'Kategori', type: 'select',
ctrlOptions:
<?php echo $kategori;?>
,ctrlAttr: { maxlength: 100 }, ctrlCss: { width: '100%'},ctrlClass: 'form-control' },
{ name: 'jumlah', display: 'Jumlah',ctrlClass: 'form-control' },
{ name: 'catatan', display: 'Catatan',ctrlClass: 'form-control' }
],
hideButtons: { moveUp: true, moveDown: true }
});
});
提前谢谢
答案 0 :(得分:2)
我认为您可以使用此代码将输入字段设置为Appendgrid上的数组
nameFormatter: function (idPrefix, name, uniqueIndex) {
return name+'[]';
}
示例:
$('#tblAppendGrid').appendGrid({
caption: 'Detail Penerimaan dana',
nameFormatter: function (idPrefix, name, uniqueIndex)
{
return name+'[]';
}});