onechiporenko / ember-models-table

Table with pagination, sorting, filtering and much more
https://onechiporenko.github.io/ember-models-table/v.5/plain-html/#/examples
MIT License
222 stars 134 forks source link

Global filter string do not get updated if initial value is passed in. #661

Open SparshithNR opened 2 weeks ago

SparshithNR commented 2 weeks ago

Note: This is the same case for all the places where local tracked variable is used for tracking the state.

pull the change or make the same changes to local clone from above. Visit: http://localhost:4201/#/examples/block-usage

Try to update the string. Put a debugger at the get and set for the filterString. https://github.com/SparshithNR/ember-models-table/blob/9a501ab8fb5a59135000278039f1c584d9155b5d/addon/components/models-table.ts#L334-L341

none

 @tracked 
 protected _filterString = this.args.filterString ?? ''; 
 protected get filterString(): string { 
   return this._filterString; 
 } 
 protected set filterString(v: string) { 
   this._filterString = v; 
 } 

or

 @trackedReset('args.filterString')
 protected _filterString = this.args.filterString ?? ''; 
 protected get filterString(): string { 
   return this._filterString; 
 } 
 protected set filterString(v: string) { 
   this._filterString = v; 
 } 
onechiporenko commented 1 day ago

Hello, @SparshithNR onDisplayDataChanged-action should be used to update initial values for fields like filterString, currentPageNumber, pageSize etc. Please check sources of https://onechiporenko.github.io/ember-models-table/v.5/plain-html/#/examples/query-params

SparshithNR commented 14 hours ago

So the idea is if value is passed in once, the consumer of EMT is responsible to handle it.