push select list element on edit only

push select list element on edit only

crush123crush123 Posts: 417Questions: 126Answers: 18

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

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    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 the input() 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

  • crush123crush123 Posts: 417Questions: 126Answers: 18

    Thanks Allan

This discussion has been closed.