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

Option to disable main SplitButton Item #7721

Closed
urielTwito opened this issue May 22, 2019 · 8 comments
Closed

Option to disable main SplitButton Item #7721

urielTwito opened this issue May 22, 2019 · 8 comments
Assignees
Labels
Type: New Feature Issue contains a new feature or new component request

Comments

@urielTwito
Copy link

urielTwito commented May 22, 2019

I'm submitting a ... (check one with "x")

[ ] bug report => Search github for a similar issue or PR before submitting
[x] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Current behavior
when using split-button there is a difference between the first item and all others
there is a main action and other actions.
I can disable any sub item (items in the drop down)
But I cannot disable the main item.
if i set disable to true, it will disable the whole control, I need to disable only the first option and not the drop down

Expected behavior
option to disable only the "main" action

  • Angular version: 7.2.7
  • PrimeNG version: 7.1.0

** I think the code fix is easy **
just remove the disabled option from the main div and from the drop down button, and it will work.

@nhrrsn
Copy link

nhrrsn commented Dec 3, 2019

Did you come up with any workarounds for this?

@urielTwito
Copy link
Author

work around I found is to change the order of the items, disabled items are last
and if all the items are disabled than the control is disabled

@cagataycivici cagataycivici changed the title p-splitButton [disabled] @Input the main item only Option to disable main SplitButton Item Mar 24, 2020
@cagataycivici cagataycivici added this to the 9.1.0 milestone Mar 24, 2020
@cagataycivici cagataycivici self-assigned this Mar 24, 2020
@cagataycivici cagataycivici added the Type: New Feature Issue contains a new feature or new component request label Mar 24, 2020
@cagataycivici cagataycivici modified the milestones: 9.1.0, 9.FUTURE May 18, 2020
@chrizy
Copy link

chrizy commented May 30, 2020

I would like it so that if the sub item array is empty then the split icon is disabled, as in my case I dont know how many sub items there will be at runtime.
Thanks

@cagataycivici cagataycivici removed this from the 11.FUTURE milestone Nov 17, 2020
@dsilvestregil
Copy link

dsilvestregil commented Jun 11, 2021

Hi @urielTwito,
I have a solution to you:

HTML
<p-splitButton label="Main" icon="pi pi-ellipsis-v" (onClick)="click()" model="items" [styleClass]="disabled ? 'split-button-main-disabled' : ''"> </p-splitButton>
You can control it with the '[styleClass]'

SCSS:
.split-button-main-disabled { button:not(.ui-splitbutton-menubutton) { cursor: default !important; } button:not(.ui-splitbutton-menubutton):hover { background-color: $primaryColor !important; } }

It works fine for me!

@zahraa-khalil
Copy link

It worked with me to use a separate button and a menu button next to each others. That way I can control disabling the main button or items button.

<div style="display: flex"> <button [disabled]="disabled" type="button" pButton style="margin-right: 2px" (onClick)="action()" label="Save" ></button> <button type="button" pButton icon="pi pi-angle-down" class="arrow-btn" (click)="action-2($event)" ></button> <p-menu #menu [popup]="true" [model]="actionsMenu"></p-menu> </div>

image

@mertsincan
Copy link
Member

Hi,

So sorry for the delayed response! Improvements have been made to many components recently, both in terms of performance and enhancement. Therefore, this improvement may have been developed in another issue ticket without realizing it. You can check this in the documentation. If there is no improvement on this, can you reopen the issue so we can include it in our roadmap?
Please don't forget to add your feedback as a comment after reopening the issue. These will be taken into account by us and will contribute to the development of this feature. Thanks a lot for your understanding!

Best Regards,

@abdullah2993
Copy link
Contributor

@mertsincan this is still not resolved, if you can please reopen this one.

@pouyababaie
Copy link
Contributor

#14602

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: New Feature Issue contains a new feature or new component request
Projects
None yet
Development

No branches or pull requests

9 participants