Edittable : Update select dropdown

Edittable : Update select dropdown

nervusdmnervusdm Posts: 6Questions: 2Answers: 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'
        } );
    } );

Answers

  • colincolin Posts: 14,303Questions: 1Answers: 2,431
    edited June 22

    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.