PDA

View Full Version : [3.0rc1] Add component to Pagingtoolbar



galdaka
27 Apr 2009, 2:48 AM
Hi,

I can´t add component (Cyclebutton) to paggingtoolbar.

Anybody know how?

Thanks,

Animal
27 Apr 2009, 3:13 AM
It's a Container. add it and call doLayout.

galdaka
27 Apr 2009, 3:23 AM
It's a Container. add it and call doLayout.

Thanks for fast reply,

I have
displayInfo: true and If I use
add, the item adds it in the end of the bar.

View image.

Thanks in advance and Greetings,

Animal
27 Apr 2009, 4:25 AM
It's a Container. Use Container methods.

galdaka
27 Apr 2009, 5:56 AM
It's a Container. Use Container methods.

Hi Animal,

Thanks for your replies.

I´m working in a PagingSizer "ala CycleButton". Here is my code:



Ext.namespace('Ext.ux.grid');
Ext.ux.grid.PageSizer = function() {
Ext.ux.grid.PageSizer.superclass.constructor.call(this, {
showText: true,
prependText: ' ',
items: [
{text: '10 entradas por página', value: 10},
{text: '15 entradas por página', value: 15, checked: true},
{text: '20 entradas por página', value: 20},
{text: '30 entradas por página', value: 30},
{text: '50 entradas por página', value: 50},
{text: '100 entradas por página', value: 100}
]
});
};
Ext.extend(Ext.ux.grid.PageSizer, Ext.CycleButton, {
init: function(paging) {
paging.on('render', this.onInitView, this);
},

onInitView: function(paging) {
paging.insert(12, this);
for(var i=0; i<this.items.length;i++){
if (this.items[i].value == paging.pageSize){
this.menu.items.itemAt(this.items[i].itemIndex).setChecked(true, true);
break;
}
}
this.on('change', this.onPageSizeChanged, paging);
},

onPageSizeChanged: function(button) {
this.pageSize = parseInt(button.getActiveItem().value);
this.doLoad(1);
}
});



Two problems:

1) I don´t know how to insert this CycleButton align to right "refresh button".

2) SetactiveItem error / bug in
this.setActiveItem(this.items[i], false) since Ext 2.x. SOLVED with: https://extjs.com/forum/showthread.php?t=20696

Various:

I change this.doLoad(); for this.doLoad(1); becuase there is a open bug about is in: http://extjs.com/forum/showthread.php?t=65635

Any suggestions?

galdaka
27 Apr 2009, 6:13 AM
The question is:

1) I don´t know how to insert this CycleButton align to right "refresh button".

Thanks,

syscobra
27 Apr 2009, 6:22 AM
can't you use insert a '->' before that button, to get the spacer to the right on the toolbar?

Or maybe you can use the Jay code to change the way of the display info for the paging toolbar...
http://extjs.com/forum/showthread.php?p=314402
look into it, maybe that helps you.

galdaka
27 Apr 2009, 6:55 AM
can't you use insert a '->' before that button, to get the spacer to the right on the toolbar?

Or maybe you can use the Jay code to change the way of the display info for the paging toolbar...
http://extjs.com/forum/showthread.php?p=314402
look into it, maybe that helps you.

I try it. View first post. And it added to right of the toolbar.

Thanks,

syscobra
27 Apr 2009, 9:35 AM
I try it. View first post. And it added to right of the toolbar.

Thanks,

Hey galdaka, when i told you about Jay's code plugin i mean is this:

init : function (parent) {

if(parent.displayInfo){
this.parent = parent;
var ind = parent.items.indexOf(parent.displayItem);
parent.remove(parent.displayItem, true);
this.progressBar = new Ext.ProgressBar({
text : this.defaultText,
width : this.progBarWidth,
animate : this.defaultAnimCfg
});

parent.displayItem = this.progressBar;

parent.add(parent.displayItem);
parent.doLayout();
Ext.apply(parent, this.parentOverrides);

In his plugin he takes out the displayItem of the parent. And just replaced for the Progress Bar he made. So if you can get that displayItem and then remove, put your cycle button + the original displayItem you get what you want. Well just a suggestion to see if that way you can make it work.
nice addon if u finish this. Just had to make it language locale available. B)

galdaka
27 Apr 2009, 10:08 AM
Hei thanks,

But I don´t want remove anything just add one cyclebutton right to original refresh button.

I don´t know how :s

Greetings,

syscobra
27 Apr 2009, 5:25 PM
Hei thanks,

But I don´t want remove anything just add one cyclebutton right to original refresh button.

I don´t know how :s

Greetings,

I am telling you, you dont have to remove it forever, just copy to a var,
var displayItem = parent.displayItem;
then remove it:
parent.remove(parent.displayItem, true);
After that you end with the pagingtoolbar without the display message (the "Displaying 1-20 of X items) now you add to the parent as in the code of Jay:
parent.add(yourCycleButton);
Now after that you just add the displayItem:
parent.add(displayItem);

You don't have to remove forever that just remove insert yours and insert again the displayItem.

Maybe that works, it has logic.

galdaka
28 Apr 2009, 2:52 AM
Solved. View plugin: https://extjs.com/forum/showthread.php?p=322536#post322536

Greetings,