Is there a way to disable multi select?
Asked
Active
Viewed 1.2k times
6 Answers
9
I know this is an old question, but updates to Slickgrid now allow you to disable multiSelect in the grid options:
var options = {
editable: false,
enableCellNavigation: true,
asyncEditorLoading: false,
multiSelect: false
};
With this option, clicking while holding a ctrl or shift does nothing, and undesirably, you cannot deselect a cell with ctrl + click, or clicking the selected cell again

pclem12
- 449
- 10
- 23
-
This doesn't stop someone from holding down shift key and then arrow key to multiselect .... – benjaminz Dec 09 '16 at 18:22
7
In don't know of any setting to disable it.
handle the onSelectedRowsChanged
event and do something like:
var selectedRows = grid.getSelectedRows();
if( selectedRows.length > 1 ) {
grid.setSelectedRows( [ selectedRows[ selectedRows.length - 1 ] ] );
}

PrimosK
- 13,848
- 10
- 60
- 78

Chris Hogan
- 71
- 1
-
1Unless there's a way to suppress triggering the event again, isn't this a closed loop? – reergymerej Jan 02 '13 at 21:18
1
with this code you can disable multiselect:
document.getElementById('mySelectBox').removeAttribute("multiple");;
... of a selectbox like this:
<select multiple="multiple" id="mySelectBox">
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
</select>
(not tested)

Garis M Suero
- 7,974
- 7
- 45
- 68
0
Remove the muiltiple="multiple"
in the following line:
<select id="id" name="name" multiple="multiple">
So, it is as good as removing that attribute. I'd use jQuery.
0
<select multiple="multiple" size="3">
<option value="1" disabled>One</option>
<option value="2" disabled>Two</option>
<option value="3" disabled>Three</option>
</select>

Mohsin Mujawar
- 186
- 7
-
-
I don't see any other answer which adds `disabled` attributes to the ` – Martin Tournoij Sep 02 '18 at 03:23
-
-
The multiple attribute is a boolean attribute, it specifies that multiple options can be selected at once. Like selected we can use disabled attribute in options. We can use both together which is not possible with disabled="true" in select tag. – Mohsin Mujawar Sep 02 '18 at 04:07
-2
Regarding your question, disable to multiple select is quite simple? Isn't it?
<select multiple="multiple" disabled = "true">
<option value="1"> One
<option value="2"> Two
<option value="3"> Three
</select>

PPShein
- 13,309
- 42
- 142
- 227