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 ?
I tried
bSubmit: function() { return "Save edits" },
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] }
}
} );
You should use just use recreateForm: true property:
See the demo.
If you would search for
recreateFormyou will find how many time I wrote recommendation of use it. I posted even the suggestion to make therecreateForm:trueandrecreateFilter:trueas 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).