o5 / grido

Grido - DataGrid for Nette Framework
http://o5.github.io/grido-examples/
MIT License
90 stars 88 forks source link

please add addFilterMultiSelect #62

Closed JanBRD closed 10 years ago

JanBRD commented 11 years ago

I just noticed Grido does not support multiselect.

Please add new add addFilterMultiSelect filter to allow to select multiple items by using Nette's MultiSelectBox component. Grido should display rows matching all selected items, so yes - IN SQL operator will make it.

Alternatively you can extend addFilterSelect by adding third parameter indicating multiSelect.

BTW - if you need boostrap css/js multiselect code, I found this: http://davidstutz.github.io/bootstrap-multiselect/ however any simple multiselect will be fine.

Thank you very much!!!

o5 commented 10 years ago

Hello Jan, you can use addFilterCustom() method like this:

$grid->addFilterCustom('gender', new Nette\Forms\Controls\MultiSelectBox('Gender', $items))
    ->setWhere(function($value, Nette\Database\Table\Selection $selection) {
           $selection->where('gender IN ?', $value);
});