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

#26 Added a server side filtering example #87

Merged

Conversation

hanuhimanshu
Copy link

@hanuhimanshu hanuhimanshu commented Jan 6, 2019

Challenges in case of server side filtering:

  1. No initial options present in case of server side filtering
  2. MatSelect do not open the drowdown when there is no MatOption found.

Solution: use mat-select-search inside disabled mat-option, making it as first option of the dropdown. re-style that mat-option to let mat-select-search sticky at top.

I would suggest mat-select-search should be used inside disabled mat-option as first child. Doing this will no longer require

/deep/ .cdk-overlay-pane-select-search {
  /* correct offsetY so that the selected option is at the position of the select box when opening */
  margin-top: 50px; // This won't be required anymore if mat-select-search is inside mat-option.
}

fixes #26

@hanuhimanshu hanuhimanshu changed the title Added a server side filtering example #26 Added a server side filtering example Jan 6, 2019
@macjohnny
Copy link
Member

@hanuhimanshu thanks a lot for your PR! I will have a look at it soon.

@macjohnny macjohnny changed the base branch from master to develop January 8, 2019 08:59
@macjohnny macjohnny merged commit 18a779e into bithost-gmbh:develop Jan 8, 2019
@macjohnny
Copy link
Member

macjohnny commented Jan 8, 2019

@hanuhimanshu

I would suggest mat-select-search should be used inside disabled mat-option as first child

this is a good solution for the server-side filtering case. I added a change (#93) that automatically sets the necessary css-properties and the disabled state if the component is placed inside a mat-option element.
This solution also fixes #1

I reverted the offset top in 907be48 as it would be a breaking change due to the selected option not being opened at the cursor position. Rather, you can override this offset in your application.

I furthermore refactored your example into a separate component in #91 and #92

Thanks a lot for your contribution!

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

Successfully merging this pull request may close these issues.

3 participants