Closed popozhu closed 8 years ago
init-server-filters
is responsible for creating the initial array of customQueries
when the plugin in ready.
register-server-filters
, on the other hand, is registering the listeners and corresponding handlers for each of those queries.
So, I don't see any unnecessary duplication.
params
should not receive the same key name as in customFilters
.
The former is supposed to be used for immutable data, while the latter depends on user input.
Thanks for your patience :)
Well, maybe it's better to make vue-tables compatible with this case...
In my case (params
and customFilters
have the same key), I have remove the init-server-filters
, then it becomes:
getData
only use the key(s) in params
and the default value(s) in params
init-server-filters
after the first request, which will no more clear the value of the same key in params
( https://github.com/matfish2/vue-tables/blob/master/lib/methods/get-data.js#L14 )params
will be used again (which I expected)customFilters
event with a new values, vue-tables will merge
the new value to the SAME keyI am not entirely clear as to why you would need such a cumbersome solution. As I explained params
and customFilters
serve two distinct purposes and should not be confused. SInce both are sent along with the request it is important not to have naming collisions.
If I understand correctly you are trying to give the filters an initial value. This is a feature I will probably implement in the near future, as a separate option which will address all filter types (generic filter, by column filters and custom filters) and allow the consumer to populate them in advance with an initial value other than an empty string.
If I understand correctly you are trying to give the filters an initial value.
YES!! You are right.
I've added filtersInitialValues
. See Options API for usage.
Let me know if there are any problems.
Great and so many thanks !!
Works as expected now.
Hi, I have a problem when using the same key(eg: 'mykey') both in
options.params['mykey']
andcustomFilters: ['mykey']
with these steps below:options.params = {'mykey': 'avlue'}
options.params
options.params['mykey']
is gone, the value is clear by the same key ofcustomFilters: ['mykey']
As far as I can tell, after the first request, vuetable will call
initServerFilters
to init customFilters and I don't think this is needed here, becauseregisterServerFilters
will do the same jobs in READY phase.ref:
I'm confused by these two functions, is there something I have missed?