How can I get a field to not show up in the editor pop-up window if multiple rows are selected?

How can I get a field to not show up in the editor pop-up window if multiple rows are selected?

bgilesbgiles Posts: 3Questions: 2Answers: 0
edited May 2016 in Editor

I have a table that has a field that I have disabled the ability to change. It works fine if only one row is selected, but if you select multiple rows and tell it you want to change that field. The field is disabled and is blank. I want to hide this field if the user selects more that one row, but show it if only one row is selected.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,869Questions: 1Answers: 10,137 Site admin
    Answer ✓

    Your best bet would be to use initEdit in combination with show() and hide() to show and hide the field as required.

    Allan

  • bgilesbgiles Posts: 3Questions: 2Answers: 0

    I did it like this and it worked perfect.

    Editor.on('initEdit', function () {
                Editor.show();
                if (Table.rows('.selected').data().length > 1) {
                    Editor.hide('active');
                }
            });
    

    Thanks for the fast response.

  • allanallan Posts: 61,869Questions: 1Answers: 10,137 Site admin

    Perfect! The only change I would suggest is that you use Table.rows({selected:true}).any(). That's two small changes - the first to use any() which simply saves a few characters, but more importantly use the selected selector-modifier option to get the selected rows (manual).

    Regards,
    Allan

This discussion has been closed.