Answer the question
In order to leave comments, you need to log in
Gridview: issues with select2 filter in multiple mode?
Hi friends. I put the select2-widget filter in the gridview, in the multi-value selection mode. Without pjax everything works fine, you can select multiple values from the list and everything is updated as it should. As soon as I turn on pjax in the gridview - this filter starts to fail, because the search for values itself turns out to be located in the td cell for filters, and works like a filter when focus is lost, even if there is written a kryakozyabra which is not in the list of the select itself.
The question is - how do I ignore the change of this field inside select2? so the gridview doesn't think it's time to apply the filter. it is necessary that it be applied only when choosing a specific value from the options offered by the select.
because of this field, gridview thinks that this field is already with a filter, and it must be applied when focus is lost.
Who really solves the problem - I will give my hard-earned 500r. otherwise I’ve been trying to fix this crap all day, and there’s nothing good in Google, as if I’m the only one who has this problem.
Answer the question
In order to leave comments, you need to log in
Decision:
$(function () {
$(document).on('change.yiiGridView keydown.yiiGridView click.yiiGridView', '#grid-orders-filters input[type="search"]', function (e) {
e.preventDefault();
e.stopPropagation();
e.stopImmediatePropagation();
return false;
});
});
I have not experimented with this moment, but the following options are seen:
1. Follow the click, open select 2 in the modal so that the gridView script does not work
2. You can try to hook on the events that the js gridView generates, discussed here:
https:// github.com/yiisoft/yii2/issues/14386
3. You can disable the submit altogether when focus is lost in the gridView config: https://www.yiiframework.com/doc/api/2.0/yii-grid-...
Respectively for others cells to implement handles.
4. You can try to change the selector so that the regular js would stop working (not sure, but you can try):
https://www.yiiframework.com/doc/api/2.0/yii-grid-...
https://www .yiiframework.com/doc/api/2.0/yii-grid-...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question