SelectOneButton responsive

Forum rules
Please note that response time for technical support is within 3-5 business days.
Post Reply
bigzidane
Posts: 58
Joined: 21 Jan 2015, 22:16

11 Nov 2016, 23:51

Hello Team,

I'm using SelectOneButton to present letter A to Z horizontally. It is working fine on laptop's browser. Same page on phone such as iPhone, all buttons (from A to Z) drop vertically which is not looking good.

Could we somehow change from SelectOneButton to SelectOneMenu dropbox like Sort function of DataTable?

Thanks,
Nghia

mert.sincan
Posts: 5281
Joined: 29 Jun 2013, 12:38

18 Nov 2016, 09:58

It is not possible with SelectOneButton. But maybe, you can try the following workaround for this case;

Code: Select all

//Css
.ShowOnMobile {
    display: none;
}

@media(max-width:640px) {
    .ShowOnDesktop {
        display: none;
    }

    .ShowOnMobile {
        display: block;
    }
}

//xhtml
<p:selectOneButton styleClass="ShowOnDesktop">
    <f:selectItem itemLabel="A" itemValue="A" />
    <f:selectItem itemLabel="B" itemValue="B" />
    <f:selectItem itemLabel="C" itemValue="C" />
    <f:selectItem itemLabel="D" itemValue="D" />
    <f:selectItem itemLabel="E" itemValue="E" />
    <f:selectItem itemLabel="F" itemValue="F" />
</p:selectOneButton>

<p:selectOneMenu styleClass="ShowOnMobile">
    <f:selectItem itemLabel="Select Item" itemValue="" />
    <f:selectItem itemLabel="A" itemValue="A" />
    <f:selectItem itemLabel="B" itemValue="B" />
    <f:selectItem itemLabel="C" itemValue="C" />
    <f:selectItem itemLabel="D" itemValue="D" />
    <f:selectItem itemLabel="E" itemValue="E" />
    <f:selectItem itemLabel="F" itemValue="F" />
</p:selectOneMenu>

Post Reply

Return to “Ultima - PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 14 guests