slim-select icon indicating copy to clipboard operation
slim-select copied to clipboard

mandatory isn't workin

Open ChristerE opened this issue 5 years ago • 0 comments

When I add mandatory I expect that the delete button (x) should disappear, but whatever I try it fails, see code and examples below. Besides the code below I've also tried the other example, but with the same result: <option value="A" data-mandatory="true" selected>A</option>

I have the following code: Select element: <select id="test-mandatory" multiple></select> <script> $(document).ready(function () { var test_mandatory = new SlimSelect({ select: 'select#test-mandatory' }); const data = [ { value: '1', text: 'Mounting', mandatory: true, }, { value: '2', text: 'Listing', mandatory: false }, { value: '3', text: 'Painting', mandatory: false }, { value: '4', text: 'Plating', mandatory: false } ]; test_mandatory.setData(data); test_mandatory.set(["1", "2", "4"]); console.log('test_mandatory: ' + JSON.stringify(data)) }); </script> The console shows: test_mandatory: [{"value":"1","text":"Mounting","mandatory":true},{"value":"2","text":"Listing","mandatory":false},{"value":"3","text":"Painting","mandatory":false},{"value":"4","text":"Plating","mandatory":false}]

I would like to have the "Mounting" option without the delete button.

test_mandatory_1

ChristerE avatar Jun 28 '20 20:06 ChristerE