File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed
Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change 1+ Version 0.5.2 - Jan 4, 2021
2+ ----------------------------
3+ - Fix: error in Filtering for multiselect
4+
5+
16Version 0.5.1 - Jan 3, 2021
27----------------------------
38- Fix: error in argument validation in Pagination
Original file line number Diff line number Diff line change @@ -342,9 +342,13 @@ public static function filter(): ?Filter
342342 }
343343 break ;
344344 case 'user_role ' :
345- if (is_string ($ value ) && strlen ($ value ) < 100 ) {
345+ if (( is_string ($ value ) && strlen ($ value ) < 100 ) || ( is_array ( $ value ) && count ( $ value ) < 500 ) ) {
346346 self ::$ filterFields [$ key ] = $ value ;
347- $ value = array_filter (explode (', ' , $ value ));
347+
348+ if (is_string ($ value )) {
349+ $ value = array_filter (explode (', ' , $ value ));
350+ }
351+
348352 $ whereHasClause = 'whereHas ' ;
349353 $ query = self ::$ query ;
350354
@@ -620,7 +624,13 @@ public static function renderFields()
620624 if (config ('datagrid.vueMultiselect ' )) {
621625 $ filterFieldsContent .= '<vue-multiselect :id=" \'' .$ htmlOptions ['id ' ].'\'" :options= \'' .json_encode ($ rolesList ).'\' :values= \'' .json_encode ($ role ).'\' :placeholder-text=" \'Select Role \'"></vue-multiselect> ' .PHP_EOL ;
622626 } else {
623- $ filterFieldsContent .= '' ;
627+ $ roleValues = array_column ($ role , 'value ' );
628+ $ filterFieldsContent .= '<select id=" ' .$ htmlOptions ['id ' ].'" name=" ' .$ htmlOptions ['id ' ].'[]" class="form-control form-control-sm" multiple> ' ;
629+ foreach ($ rolesList as $ roleItem ) {
630+ $ selected = in_array ($ roleItem ['value ' ], $ roleValues ) ? ' selected ' : '' ;
631+ $ filterFieldsContent .= '<option value=" ' .$ roleItem ['value ' ].'" ' .$ selected .'> ' .$ roleItem ['label ' ].'</option> ' ;
632+ }
633+ $ filterFieldsContent .= '</select> ' ;
624634 }
625635 break ;
626636
You can’t perform that action at this time.
0 commit comments