A free open source IT asset/license management system
Fixed - Added a “clear selection” option to select2 ajax lists
sniped68d95a91541
diff --git a/app/Http/Transformers/SelectlistTransformer.php b/app/Http/Transformers/SelectlistTransformer.phpindex 54b55122fc..6aac737b07 100644--- a/app/Http/Transformers/SelectlistTransformer.php+++ b/app/Http/Transformers/SelectlistTransformer.php@@ -19,7 +19,7 @@ class SelectlistTransformerpublic function transformSelectlist (LengthAwarePaginator $select_items){- $items_array = [];+// Loop through the paginated collection to set the array valuesforeach ($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' =>diff --git a/resources/lang/en/general.php b/resources/lang/en/general.phpindex 854787ed91..c753a311c3 100644--- a/resources/lang/en/general.php+++ b/resources/lang/en/general.php@@ -40,6 +40,7 @@'checkout' => 'Checkout','city' => 'City','click_here' => 'Click here',+ 'clear_selection' => 'Clear Selection','companies' => 'Companies','company' => 'Company','component' => 'Component',