Different editor select list for each row of a datatable

Different editor select list for each row of a datatable

ubdpetersubdpeters Posts: 26Questions: 8Answers: 0

Is it possible to list different items in a select list for a field in an editor window?
If I have a field called "Items", for the first row I only want to allow the user to select any one of "Item 1", "Item 2" or "Item 3".
For "Items" in the second row I only want the user to select from "Item 1" and "Item 2".
The third row would allow the user to select "Item 1", "Item 2", "Item 3" and "Item 4".

Answers

  • ntstravelntstravel Posts: 15Questions: 2Answers: 1

    Interesting question!
    Have you tried making up the 'select' with something based on the inline snippet?

        // Activate an inline edit on click of a table cell
        $('#example').on( 'click', 'tbody td:not(:first-child)', function (e) {
            editor.inline( this, {
                buttons: { label: '>', fn: function () { this.submit(); } }
            } );
        } );
    
  • allanallan Posts: 63,205Questions: 1Answers: 10,415 Site admin

    Yes this would be possible using the field().update() method, which lets you change the options of the select list. You could call then in an open event handler, which leaves just the issue of deciding what options you want to show in the select box for the row!

    Oh I should say to get the row being edited us table.row( editor.modifier() ).data().

    Allan

This discussion has been closed.