Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 of 2 tasks
SparshithNR opened this issue Aug 31, 2024 · 2 comments
Open
1 of 2 tasks

Comments

@SparshithNR
Copy link

SparshithNR commented Aug 31, 2024

  • I'm submitting a ...

  • What is the current behavior?
    The globalFilter do not get updated when consumer of EMT passes filterString case, because of when the get filterString is evaluated the this.args.filterString always exists. So we can never get the updated value in the filterString
    filter_string

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

  • [Bug] What is the expected behavior?
    The filterString updates

  • [Feature] What is the motivation / use case for changing the behavior?

none

  • [Support] What exactly you try to do?
    none

  • Please tell us about your environment:

  • ember-models-table version: any version
  • ember version: any version
  • ember-data version: any version
  • ember-cli version: any version
  • node version: any version
  • npm or yarn version: any version
  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc)
  • The fix is to change the how _filterString is being setup.
 @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
Copy link
Owner

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants