PDA

View Full Version : Adding buttons to PagingToolbar



damnos
25 Mar 2010, 11:13 AM
I am trying to add buttons to PagingToolbar, I see that the PagingToolbar already have the API to do this quite easily.

What I am wondering is if there's anyway to control the ordering of the items that's rendered on the toolbar? On this example http://www.extjs.com/deploy/dev/examples/grid/paging.html (http://www.extjs.com/forum/../deploy/dev/examples/grid/paging.html) The paging toolbar (from left to right) shows: <paging widget> <buttons> ....... <text>

Is there anyway to do:
<buttons> <paging widget> .... <text>

better yet, can we centralize the paging widget:
<buttons> .... <paging widget> .... <text>

Thanks for the help!

tobiu
25 Mar 2010, 3:34 PM
you do not only have "add", you have "insert" also.
look in the api of paging toolbar and you will find:



insert( Number index, Ext.Component component ) : Ext.Component
Inserts a Component into this Container at a specified index. Fires the beforeadd event before inserting, then fires ...
Inserts a Component into this Container at a specified index. Fires the beforeadd event before inserting, then fires the add event after the Component has been inserted.
Parameters:

* index : Number
The index at which the Component will be inserted into the Container's items collection
* component : Ext.Component
The child Component to insert.

Ext uses lazy rendering, and will only render the inserted Component should it become necessary.

A Component config object may be passed in order to avoid the overhead of constructing a real Component object if lazy rendering might mean that the inserted Component will not be rendered immediately. To take advantage of this 'lazy instantiation', set the Ext.Component.xtype config property to the registered type of the Component wanted.

For a list of all available xtypes, see Ext.Component.

Returns:

* Ext.Component
component The Component (or config object) that was inserted with the Container's default config values applied.


kind regards,
tobiu

damnos
26 Mar 2010, 12:21 PM
Is there anyway we can centralized the paging widget?

the buttonAlign config wont work because I'll be adding buttons to the toolbar (prependButtons: true) and I want to be:

<button> ..................... <paging widget> ................... <display text>

left-aligned.................... center-aligned .................... right-aligned

right now the <button> and the <paging widget> is always side-by-side for me