Skip to content

Force dropdown position#6139

Open
nzkozar wants to merge 10 commits into
select2:developfrom
nzkozar:force-dropdown-position
Open

Force dropdown position#6139
nzkozar wants to merge 10 commits into
select2:developfrom
nzkozar:force-dropdown-position

Conversation

@nzkozar
Copy link
Copy Markdown

@nzkozar nzkozar commented Jan 18, 2022

This pull request includes a

  • Bug fix
  • New feature
  • Translation

The following changes were made

  • Added functionality to enable forcing dropdown position to either below or above <select> element
  • Expanded the documentation (7. Dropdown) to include usage example of this new functionality

If this is related to an existing ticket, include a link to it as well.
This functionality was discussed in issue #3121
It was previously proposed in PR #4618

This PR improves upon the above linked PR #4618, so that it:

  • provides documentation changes compatible with the new .md documentation
  • provides (imo) a clearer configuration option name forceDropdownPosition, as it is more descriptive of what it does
  • uses a more standard auto default value for the proposed configuration option

Feedback is welcome, as well as pointers if anything else needs to be done to make this change ready for merge to master branch.

Enable forcing dropdown position either above or below with constructor option 'forcePosition' that takes either value 'below' or 'above'
Changed forcePosition to forceDropdownPosition and repositioned the if clause to skip automatic position checks if forceDropdownPosition option is set.
@stale
Copy link
Copy Markdown

stale Bot commented Mar 30, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale Bot added the status: stale label Mar 30, 2022
dinarde added a commit to projeto-siga/siga that referenced this pull request Apr 4, 2022
Em testes, só o aumento da modal não foi o suficiente para que o componente Select2 exercesse os cálculos de redimensionamento de forma correta.
Inclusive o problema já ocorre em produção com resoluções achatadas.

Para contornar o problema, foi implementado um Pull Request do Projeto Select2 que visa resolver esse problema, onde na criação do Select é dito qual a orientação do dropdown:
select2/select2#6139

Para usar o componente corrigido basta adicionar o script após o Select2:

<script type="text/javascript" src="/api/public/proxy?url=https%3A%2F%2Fgithub.com%2Fsiga%2Fjavascript%2Fselect2%2Fselect2.min.js"></script>
<script type="text/javascript" src="/api/public/proxy?url=https%3A%2F%2Fgithub.com%2Fsiga%2Fjavascript%2Fselect2%2Fi18n%2Fpt-BR.js"></script>
<script type="text/javascript" src="/api/public/proxy?url=https%3A%2F%2Fgithub.com%2Fsiga%2Fjavascript%2Fsiga.select2.js"></script>
<script type="text/javascript" src="/api/public/proxy?url=https%3A%2F%2Fgithub.com%2Fsiga%2Fjavascript%2Fselect2%2Fselect2-dropdownPosition.js"></script>

O Select sempre abrirá para baixo nas telas Modais implementadas: Seleção de Pessoa , Cargo , Lotação e Função de Confiança e segue o Scroll lateral para percorrer a lista normalmente:
@dinarde
Copy link
Copy Markdown

dinarde commented Apr 4, 2022

Congratulations. This solved my problem with using Select 2 with Modal Bootstrap

@stale stale Bot removed the status: stale label Apr 4, 2022
@audibook
Copy link
Copy Markdown

audibook commented Apr 4, 2022

This is a must have feature. Please consider merging it into master.

@stale
Copy link
Copy Markdown

stale Bot commented Jun 12, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale Bot added the status: stale label Jun 12, 2022
@sadiesaurdiff
Copy link
Copy Markdown

Please do not close, this is a valid option.

Copy link
Copy Markdown

@dogawaf dogawaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix code style issues

Comment thread src/js/select2/dropdown/attachBody.js Outdated
Comment thread src/js/select2/dropdown/attachBody.js Outdated
Comment thread docs/pages/07.dropdown/docs.md Outdated
Comment thread docs/pages/07.dropdown/docs.md Outdated
Comment thread docs/pages/07.dropdown/docs.md Outdated
Comment thread docs/pages/07.dropdown/docs.md Outdated
nzkozar and others added 6 commits May 17, 2023 10:29
Fix code style

Co-authored-by: Rémy DANIEL <dogawaf@gmail.com>
Fix code style

Co-authored-by: Rémy DANIEL <dogawaf@gmail.com>
Fix code style

Co-authored-by: Rémy DANIEL <dogawaf@gmail.com>
Fix code style

Co-authored-by: Rémy DANIEL <dogawaf@gmail.com>
Fix code style

Co-authored-by: Rémy DANIEL <dogawaf@gmail.com>
Fix code style

Co-authored-by: Rémy DANIEL <dogawaf@gmail.com>
@nzkozar
Copy link
Copy Markdown
Author

nzkozar commented May 17, 2023

Please fix code style issues

@dogawaf I made the changes you suggested. Let me know if anything else is needed.

@carloswm85
Copy link
Copy Markdown

This PR requires attention.

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.

6 participants