How to set the title / message of the editor form via the editor api?
How to set the title / message of the editor form via the editor api?
pingcrosby
Posts: 29Questions: 4Answers: 1
I am trying to use the editor api to simply set the title and message during edit/create.
No errors are shown. But the form is not displaying the text.
Obviously I am misusing the API but I cannot quite see where i have gone wrong.
Can anyone help me ..
Thanks in advance
cpdHoursEditor = new $.fn.dataTable.Editor({ ... });
cpdHoursTable = $('#cpdHoursTable').DataTable({ ... });
// this does nothing
cpdHoursEditor.title('My Edit Title').buttons('edit');
cpdHoursEditor.title('My New Title').buttons('create');
// this sets the message the first time the editor form is displayed.. after that no message is displayed
cpdHoursEditor.message("mymessage").buttons("edit)
This discussion has been closed.
Answers
It will work, but it will then be overridden when the editor is activated by the
New
,Edit
, etc buttons.Use the internationalisation options for Editor to customise the titles and buttons for when the Buttons are activated.
If you prefer to use the API methods, use then in
initEdit
etc.Allan
Brilliant thanks for this..
Sorry i missed it in the documentation.
Is the API inconsistent ?? -
There seems to be no 'message' API within i18n.
For the on init event there seems to be no title() api call.
To get both the title and message form functionality i have needed to use a combintation of both i18n and the initEdit api?
No, because the message is generally assumed to be dynamic unlike the other strings which are generally static (i.e. don't change).
It does, but it is then more-or-less immediately overwritten by the
title works
since the title is set by Editor afterinitEdit
. Instead what you could do is useopen
:Allan