PDA

View Full Version : GridPlugins using RowExpander



pourmo
16 Jul 2009, 1:10 AM
Hi

In your demo for GridPlugins using RowExpander.

http://extjs.com/examples/explorer.html#gridplugins

How can we expand all rows when using the RowExpander plugin?

Regards

mo

bramvano
21 Jul 2009, 3:38 AM
I'd like to know this to!

Arno.Nyhm
5 Aug 2009, 6:29 AM
i found a way to do it. but i think its a very "dirty" soultion. i try to simulate a click on the rowexpander. the problem was, that i can not create an event :-( so i overwrite the getters which are used by rowexpander.

maybe someone find a more elegant solution to create a gridevent/event :-)


grid.addListener(Events.ViewReady, new Listener<BaseEvent>() {

public void handleEvent(BaseEvent be) {
NodeList<Element> select = DomQuery.select(".x-grid3-row-expander", grid.getElement());
GWT.log("expand all start", null);
for (int i = 0; i < select.getLength(); i++) {
final Element elem = select.getItem(i);
GWT.log("item: " + i, null);

grid.fireEvent(Events.RowClick, new GridEvent<Stock>(grid) {

@Override
public Element getTarget() {
return elem;
}

@Override
public El getTargetEl() {
return new El(getTarget());
}
});
}
GWT.log("expand all end", null);
}
});

bramvano
6 Aug 2009, 12:09 AM
I've found a solution that's a bit simpler...

stating the obvious....
ExpandAll(true) expands all rows
ExpandAll(false) collapses all row

the function...

function ExpandAll (expand)
{
for (var x=0; x<gridStore.getCount(); x++)
{
if (expand)
rowExpander.expandRow(x);
else
rowExpander.collapseRow(x);
}

gridPanel.getView().focusRow(0);
gridPanel.getView().ensureVisible(0, 0, false);
}

Arno.Nyhm
7 Aug 2009, 2:56 AM
how did you implement this? (because its javascript)

bramvano
7 Aug 2009, 3:28 AM
Sorry, I was under the impression that this was in the ExtJs forum...

Arno.Nyhm
7 Aug 2009, 3:33 AM
@bramvano

but big thanks for the idea :-)

i make a ExtendedRowExpander from your idea :-)
http://www.extjs.com/forum/showthread.php?p=370315#post370315