问题描述
使用bSubmit指定用于编辑和添加按钮的不同文本.如果打开和关闭编辑表单,打开和关闭添加表单,然后再次打开编辑表单,则编辑表单按钮标题将变为添加行".如何解决此问题,以使编辑表单保存按钮文本始终为保存编辑"?
Different texts for edit and add form for Save button are specified using bSubmit.If edit form is opened and closed, add form is opened and closed and edit form is opened again, edit form button caption becomes "Add row".How to fix this so that edit form save button text is "Save edits" always ?
我尝试了
bSubmit: function() { return "Save edits" },
在按钮上放置此打印function()....
put this prints function() ... in button.
grid.navGrid("#grid_toppager", { refreshstate: 'current' },
{ url: 'Edit',
editData: { _dokdata: FormData },
savekey: [true, 13],
closeOnEscape: true,
bSubmit: "Save edits",
reloadAfterSubmit: false
},
{ url: 'Add',
bSubmit: "Add row",
editData: { _dokdata: FormData },
savekey: [true, 13],
recreateForm: true,
closeOnEscape: true,
clearAfterAdd: true,
addedrow: 'last',
reloadAfterSubmit: false,
afterSubmit: function (response) { return [true, '', response.responseText] }
}
} );
推荐答案
您应该只使用 recreateForm:true 属性:
myGrid.jqGrid('navGrid', '#pager',
{ add: true, edit: true, del: false, search: false },
{ bSubmit: "Submit Edit", recreateForm: true }, // Edit options
{ bSubmit: "Submit Add", recreateForm: true } // Add options
);
请参见演示.
如果您要搜索recreateForm
,您会发现我写了多少次使用它的建议.我甚至发布了将和recreateFilter:true
设置为默认设置的建议,但未收到任何响应.我只能重复将设置用作您的默认设置,您的问题就会减少.如果您使用自定义编辑控件,则必须使用自定义编辑的大多数实现中的设置(请参见这里).
If you would search for recreateForm
you will find how many time I wrote recommendation of use it. I posted even the suggestion to make the recreateForm:true
and recreateFilter:true
as default settings, but received no response. I can only repeat use the settings as your default settings and you will have less problems. If you use custom editing controls you have to use the setting in the most implementations of the custom editing (see here).
这篇关于如何在编辑中添加不同的文本以保存按钮并在jqgrid中添加表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!