laravel-enso / select

Bulma styled single and multi-select component with a server-side option list builder
https://laravel-enso.com/examples/select
MIT License
26 stars 15 forks source link

Dynamic select issues on non-numeric ID column #35

Closed alanwhite2019 closed 5 years ago

alanwhite2019 commented 5 years ago

Hi. @gandesc

I am having issues with dynamic select:

  1. Selected value does not sustain on dynamic search and table auto reload back to its default.

Any guide please?

gandesc commented 5 years ago

Hi Alan,

I'm afraid I'm not following: is it an issue with the select or the data table?

Can you provide more information?

alanwhite2019 commented 5 years ago

Hi @gandesc Here you can see the problem in my screenshot: https://www.screencast.com/t/lv7qwvhV

What I am doing in code for: Destination Name filter (second filter):

  1. Route: Route::get('get-destination-tags', 'DestinationController@options')->name('get-destination-tags');
  2. In my controller i added:

    use OptionsBuilder;
    protected $queryAttributes = ['destination_name', 'id'];
    
    public function query() {
       return RateCard::select(['destination_name','id'])->groupBy('destination_name');
    }
  3. In my VUE file:
    <vue-select-filter class="box"
     source="/get-destination-tags"
     label="destination_name"
     title="Destination Name"
    trackBy="destination_name"
    value="filters.rate_cards.destination_name"
    :limit="limit"
    v-model="filters.rate_cards.destination_name"/>
    </vue-select-filter>

    In Data, i defined:

    filters: {
                   rate_cards:{
                        destination_name:'',
                        tpid:'',
                        prefix:''
                    },
    },
alanwhite2019 commented 5 years ago

I commented Line 369 in VueSelect.vue and it worked for me.

hideDropdown() {
            // this.query = '';
            this.dropdown = false;
            this.position = null;
        },

image