Update performance in the selected selection field

I use jQuery Chosen for individual blocks and Bootstrap 2.3.2. I have two selection blocks with the same parameters, where the values ​​are strings. If I select an option in the first selection field, this option is disabled in the second selection field and vice versa. If I disable the option in the first selection window, this option is enabled in the second selection field and vice versa.

Basically, I have two selected fields that have the same parameters, but you can select the same parameters in only one selection window.

I use the reset button for the first selection window, which updates the selection fields to their original state. This means that for all parameters in the first select selectedbox, the attribute is false, and for all parameters in the second select box, the attribute disabledis false.

The problem is performance. When I press the reset button, the update of the option attributes and the selected selection field is too large. I want to use the reset button to select fields with more than one thousand options, but I don’t know if I have to change my code or use a different selection plugin.

jsfiddle

$(".keywordContain").click(function(){
    $('select[name=keywordContainSelect] option').prop('selected', false).trigger('chosen:updated');
    $('select[name=keywordNotContainSelect] option').prop('disabled', false).trigger('chosen:updated');
});
+4
source share
1 answer

"selected: updated" . <select>:

$(".keywordContain").click(function () {
    $('select[name=keywordContainSelect] option').prop('selected', false);
    $('select[name=keywordNotContainSelect] option').prop('disabled', false);
    $(".selectKeyword").trigger("chosen:updated");
});

jsfiddle.

+2

All Articles