Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Should be able to set max no. items to display in md-autocomplete dropdown #8751

Closed
chrismortega opened this issue Jun 13, 2016 · 7 comments
Closed
Assignees
Labels
has: Pull Request A PR has been created to address this issue type: enhancement ui: CSS
Milestone

Comments

@chrismortega
Copy link

chrismortega commented Jun 13, 2016

Actual behavior:

  • What is the issue? md-autocomplete only shows 2 or so items max when pulled down.
  • What is the expected behavior? Should be an option to display n items if the real-estate is available.

You can write some css to make the list taller, but you have to hard-code it so that if the number of entries is smaller than your hard-coded value you end up with blank space. The md-autocomplete should be updated to allow a max, but still shrink when there aren't enough items to reach that max.

CodePen or Steps to reproduce the issue: *

  • CodePen Demo which shows your issue :
  • Details:

Angular Versions: *

  • Angular Version: *
  • Angular Material Version: *

Additional Information:

  • Browser Type: *
  • Browser Version: *
  • OS: *
  • Stack Traces:

Shortcut to create a new CodePen Demo.
Note: * indicates required information. Without this information, your issue may be auto-closed.

Do not modify the titles or questions. Simply add your responses to the ends of the questions.
Add more lines if needed.

@devversion devversion self-assigned this Aug 9, 2016
@devversion
Copy link
Member

@chrismortega Sorry for the late response. I was looking at your issue right now.

I have some problems understanding your expected behavior.

  • You want to be able to set the maximum amount of items shown in the dropdown?
  • You want to be able to increase / decrease the height of the dropdown?

@devversion devversion added the needs: more info The issue does not contain enough information for the team to determine if it is a real bug label Aug 13, 2016
@chrismortega
Copy link
Author

On higher resolutions an opened md-autocomplete could be much more effective if it took some advantage of the extra space it has to drop down. Currently it seems to have a max height. It would be better if I could specify a default height or num items to try to use. It would then need to determine if it has the space to use my desired height, and if not use as much as it can without being cut off.

If that's still confusing please let me know. Thanks!

@devversion
Copy link
Member

devversion commented Aug 13, 2016

I think that's reasonable.

I have in mind an attribute like md-dropdown-items="6" and the it determines if those have enough place to show completely, otherwise it will shrink as less as possible.

I will try to take a look at this functionality and also confirm with the specs.

Thanks for the info :)

@devversion devversion added type: enhancement ui: CSS and removed needs: more info The issue does not contain enough information for the team to determine if it is a real bug labels Aug 13, 2016
@chrismortega
Copy link
Author

That would be a dream come true, ha. Thank you!

@chrismortega
Copy link
Author

Oh one more clarification: if I specify md-dropdown-items="6" but I only have 3 items in the dropdown the height should shrink to show just those 3 items, rather than showing 3 items plus 3 more items with of blank of blank space.

devversion added a commit to devversion/material that referenced this issue Aug 14, 2016
…ems.

* Adds an attribute, which allows developer to overwrite the amount of items shown in the autocomplete dropdown.
  - When the dropdown doesn't fit into the possible space it will shrink accordingly (as same as before)
  - When the specified amount of items is higher than the current matches then it will shrink (as same as before)

* Fixes the item height deviations between CSS and JavaScript.
* Removed the unnecessary CSS for the dropdown height, because everything will be handled from the JS (same as before)
* Added tests for the dropdown height calculation, which make sure that everything is now calculated properly.

Fixes angular#9306. Closes angular#8751.
@devversion devversion added the has: Pull Request A PR has been created to address this issue label Aug 14, 2016
@devversion
Copy link
Member

@chrismortega Perfect, I actually thought about the same :)

Also the PR is now pending with #9307

@chrismortega
Copy link
Author

Just had a look at the code. Looks awesome, thanks!

@ThomasBurleson ThomasBurleson added this to the 1.1.2 milestone Aug 22, 2016
devversion added a commit to devversion/material that referenced this issue Sep 4, 2016
…ems.

* Adds an attribute, which allows developer to overwrite the amount of items shown in the autocomplete dropdown.
  - When the dropdown doesn't fit into the possible space it will shrink accordingly (as same as before)
  - When the specified amount of items is higher than the current matches then it will shrink (as same as before)

* Fixes the item height deviations between CSS and JavaScript.
* Removed the unnecessary CSS for the dropdown height, because everything will be handled from the JS (same as before)
* Added tests for the dropdown height calculation, which make sure that everything is now calculated properly.

Fixes angular#9306. Closes angular#8751.
@kara kara closed this as completed in #9307 Sep 8, 2016
kara pushed a commit that referenced this issue Sep 8, 2016
…ems. (#9307)

* Adds an attribute, which allows developer to overwrite the amount of items shown in the autocomplete dropdown.
  - When the dropdown doesn't fit into the possible space it will shrink accordingly (as same as before)
  - When the specified amount of items is higher than the current matches then it will shrink (as same as before)

* Fixes the item height deviations between CSS and JavaScript.
* Removed the unnecessary CSS for the dropdown height, because everything will be handled from the JS (same as before)
* Added tests for the dropdown height calculation, which make sure that everything is now calculated properly.

Fixes #9306. Closes #8751.
Frank3K pushed a commit to Frank3K/material that referenced this issue Sep 11, 2016
…ems. (angular#9307)

* Adds an attribute, which allows developer to overwrite the amount of items shown in the autocomplete dropdown.
  - When the dropdown doesn't fit into the possible space it will shrink accordingly (as same as before)
  - When the specified amount of items is higher than the current matches then it will shrink (as same as before)

* Fixes the item height deviations between CSS and JavaScript.
* Removed the unnecessary CSS for the dropdown height, because everything will be handled from the JS (same as before)
* Added tests for the dropdown height calculation, which make sure that everything is now calculated properly.

Fixes angular#9306. Closes angular#8751.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
has: Pull Request A PR has been created to address this issue type: enhancement ui: CSS
Projects
None yet
Development

No branches or pull requests

3 participants