How align commandbutton?

UI Components for JSF
Post Reply
3vi
Posts: 27
Joined: 30 Nov 2011, 17:41

30 Nov 2011, 17:47

Hi and sorry for my english...i've a datatable with a command button on footer, and i don't be able to align the command button...

i've tried with style="align: right" or style="position= right", but the button is ever align in the center of datatable.

Anyone can help me?

Thanks

User avatar
kwintesencja
Posts: 316
Joined: 08 Feb 2010, 20:33
Location: Brazil

30 Nov 2011, 18:30

you have some options, the ones i remember now:

surround the button with a div:

Code: Select all

    <div align="right">
          <button/>
      </div>
use table:

Code: Select all

   <table>
       <tr>
           <td align="right"> //almost sure you can use td directly
                 <button>
             </td>
        </tr>  
  </table>
use float property:

Code: Select all

    <p:commandButton style="float="right"/>'

i hope it helps
Att,

--

Rafael Mauricio Pestano


Primefaces 5.x + JavaEE7(Glassfish 4.x and Wildfly 8)
Conventions Framework
Blog
@realpestano

3vi
Posts: 27
Joined: 30 Nov 2011, 17:41

01 Dec 2011, 11:21

Great!

Each options you have said, work!

Thanks ;)

porthos
Posts: 122
Joined: 09 May 2011, 03:17

01 Dec 2011, 13:16

Just fixing a typo in kwintesencja's answer:

Code: Select all

<p:commandButton style="float:right;"/>
I would definitely recommend using this option, rather than sticking HTML tables and divs directly into facelet code, as it often leads to unpredictable rendering errors when updating with ajax and the like.

If you feel the need for surrounding elements, use p:outputPanel, or h:panelGrid, or any other suitable JSF component instead.
-------
PrimeFaces 3.4, Glassfish 3.1.2, Mojarra 2.1.6

adolfainsley8
Posts: 1
Joined: 27 Apr 2016, 09:55

27 Apr 2016, 09:57

HTML tables and divs directly into facelet code, as it often leads to unpredictable rendering errors when updating with ajax and the like.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 22 guests