push select list element on edit only
push select list element on edit only
i have an editor form, for which i want to push an array element onto the 'quality' list
the editor field is populated on initcomplete like so..
initComplete: function ( settings, json ) {
// Populate the site select list with the data available in the
// database on load
json.refquality.push( {
label: 'Sale',
value: '3'
} );
editor.field( 'tblitem.ItemQualityID' ).update( json.refquality );
how do i push my array element onto the select on edit only ?
Thanks
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Currently there is no Editor API method to push an item onto the list, you can only replace everything with the new options using the field's
update()
method. If you need to push a single item on use theinput()
method to get a handle to the select element and then use jQuery / DOM methods to manipulate directly.For this to occur on edit only, listen for the
initEdit
event and perform the action in an event handler for it.Allan
Thanks Allan