bhaveshpatel200 / vue3-datatable

vue3-datatable is a powerful component for creating dynamic and customizable data tables. It supports large amounts of data, sorting, pagination, and filtering and highly customizable
MIT License
134 stars 19 forks source link

More flexibility on operators #27

Open FZ-Iskandar opened 8 months ago

FZ-Iskandar commented 8 months ago

It would be great if we could filter by more operators.

Heare are some examples/ideas.

in_list: ['Bascom', 'Coultervillle'] not_in_list: ['Bascom', 'Coultervillle']

for that the columnProps object could depend on a "options" list (or even better a callback function that does an api call to the backend on demand)

Another cool idea would be to support multiple conditions by each filter. Take prime vue for inspiration:

https://primevue.org/datatable/#advanced_filter

If the prior options seem like too much trouble, another option might just give the possibility to make a slot for the filter menu and allow there to modify the filter conditions

Thanks for the package!

FZ-Iskandar commented 8 months ago

Also, even if it is not really related... The 'bool' type filter, should be also translatable 😉

bhaveshpatel200 commented 8 months ago

Hi,

I will add List Filters features in future but not sure above the Multiple condition and filter slot which is complexed and its very advanced features.

For now i am focusing on other required basic features and i have other task in my list already. so will think about after all my task list completed.

FZ-Iskandar commented 7 months ago

Sorry, but do you know more or less when you can get the list options done? Dont want to preasure you, but I think that this feature is really important for filters.

This is an idea of how it could be done:

<select v-else-if="col.type === 'select'" v-model="col.value" class="bh-form-control" @change="emit('filterChange')" @click="props.isOpenFilter = null">
    <option v-for="option in col.options" :value="option && option.value !== undefined ? option.value : option">{{ option && option.text !== undefined ? option.text : option }}</option>
</select>

And this is how the bool option could be more flexible:

<select v-else-if="col.type === 'bool'" v-model="col.value" class="bh-form-control" @change="emit('filterChange')" @click="props.isOpenFilter = null">
    <option :value="col && col.allValue !== undefined ? col.allValue : undefined">{{ col && col.allText !== undefined ? col.allText : 'All' }}</option>
    <option :value="col && col.trueValue !== undefined ? col.trueValue : true">{{ col && col.trueText !== undefined ? col.trueText : 'True' }}</option>
    <option :value="col && col.falseValue !== undefined ? col.falseValue : false">{{ col && col.falseText !== undefined ? col.falseText : 'False' }}</option>
</select>