1

我正在使用引导多选库。我需要获取当前实例并在 onselectall 事件中触发 onchange。我怎样才能做到这一点 ?

$('.binding.list').multiselect({
            onSelectAll: function (checked) {
                var $t = ... // get current instance like $(this).select
                $t.trigger('change'); // triggering onchange event
            },
            onChange: function (element) {
                var $t = $(element).parent('select'),
                    data = {};

                var values = $t.find('option:selected').map(function (i, opt) {
                    return $(opt).val();
                }).toArray().join(',');

                data["values"] = values;
                data["parameterName"] = $t.closest('tr').data('parametername');

                postRemoteWithAlways(bindingDefaultValueListOnChangeRemote, data);
            }
        });
4

0 回答 0