Edittable : Update select dropdown

Edittable : Update select dropdown

nervusdmnervusdm Posts: 9Questions: 4Answers: 0

Hey guys,

I would like to update a dropdown inline, on change.
How can I achieve this ?

I use "onBlur", but I believe there is an other choice.

    $('#hs_lit').on( 'click', 'tbody td', function (e) {
        editor.inline( this,{
          //  onBlur: 'submit'
        } );
    } );

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,142Questions: 1Answers: 2,586
    edited June 2022 Answer ✓

    This example from this thread is doing something similar, it's adding a value to the Office dropdown using initEdit - that works for both inline and editing in the form. You could use the same event to modify your dropdown.

      editor.on('initEdit', function(e, node, data, items, type) {
        var field = editor.field('office');
        var options = [];
        $(field.node()).find('option').each(function() {
          options.push($(this).val());
        })
    
        if ($.inArray(data.office, options) < 0) {
          options.push(data.office)
          field.update(options)
        }
      })
    

    Colin

Sign In or Register to comment.