Fixed - Added a “clear selection” option to select2 ajax lists

This commit is contained in:
snipe 2017-11-04 00:19:16 -07:00
parent 15d4344efb
commit d68d95a915
2 changed files with 5 additions and 1 deletions

View file

@ -19,7 +19,7 @@ class SelectlistTransformer
public function transformSelectlist (LengthAwarePaginator $select_items)
{
$items_array = [];
// Loop through the paginated collection to set the array values
foreach ($select_items as $select_item) {
@ -32,6 +32,9 @@ class SelectlistTransformer
}
// This is weird and awful, but the only way I can find to allow the user to
// clear the selection - @snipe
array_unshift($items_array, ['id' =>'', 'text'=> trans('general.clear_selection')]);
$results = [
'items' => $items_array,
'pagination' =>

View file

@ -40,6 +40,7 @@
'checkout' => 'Checkout',
'city' => 'City',
'click_here' => 'Click here',
'clear_selection' => 'Clear Selection',
'companies' => 'Companies',
'company' => 'Company',
'component' => 'Component',