开发者

Disable multi select?

开发者 https://www.devze.com 2023-01-12 21:22 出处:网络
Is there a way to d开发者_如何学运维isable multi select?I know this is an old question, but updates to Slickgrid now allow you to disable multiSelect in the grid options:

Is there a way to d开发者_如何学运维isable multi select?


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


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 ] ] );
}


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)


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.


<select multiple="multiple" size="3">
    <option value="1" disabled>One</option>
    <option value="2" disabled>Two</option>
    <option value="3" disabled>Three</option>
</select>


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>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号