yii2 gridview filterSelector 不考虑未经检查的输入

yii2 gridview filterSelector doesn't consider unchecked input

我在 Yii2 框架中使用 GridView。

'filterSelector' => 'input[name="AccountSearch[field]"]',


<?= Html::checkbox('AccountSearch[field]', $searchModel->field == true, [
        'label' => 'Field', 'value' => 1
]) ?>

当我第一次点击它时 - 它运作良好。但是当我点击更多次时 - 复选框始终处于选中状态。在 http 请求中,我看到 pjax 总是发送 'field' = 1。Gridview 或 pjax 错误?

隐藏输入默认自动生成

link

uncheck: string, the value associated with the uncheck state of the radio button. If not set, it will take the default value 0. This method will render a hidden input so that if the radio button is not checked and is submitted, the value of this attribute will still be submitted to the server via the hidden input. If you do not want any hidden input, you should explicitly set this option as null