PDA

View Full Version : RowEditor vs RowExpander



siberian
28 Dec 2009, 3:44 PM
I need to have my UI do RowEditing but also need a RowExpander. Right now, clicking on the Expander also invokes the Editor so they are locked in power struggle.

Closing the Editor leaves the expansion but its really funky looking.

I saw a post that addressed this for ExtJS but nothing for GXT.

Anyone know how to get GXT to properly handle this? The real goal is :

IF expander is closed, clicking a non expander field (eg: not the first column) starts up the roweditor

IF expander is open, clicking a non-expander field does nothing



... Data retrieval code removed ..
List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
RowExpander expander = new RowExpander() ;
XTemplate tpl = XTemplate.create("<p><b>Company:</b> {name}</p><br><p><b>Summary:</b> {desc}</p>");
expander.setTemplate(tpl);
columns.add(expander);

TextField<String> text = new TextField<String>();
text.setAllowBlank(false);

column = new ColumnConfig("name", "Name", 200);
column.setEditor(new CellEditor(text));
columns.add(column);

ColumnModel cm = new ColumnModel(columns);

final RowEditor re = new RowEditor();

ContentPanel cp = new ContentPanel();
cp.setHeading("Expander Rows, Collapse and Force Fit");
cp.setIconStyle("icon-table");
cp.setAnimCollapse(false);
cp.setCollapsible(true);
cp.setLayout(new FitLayout());
cp.setSize(600, 300);

Grid<BeanModel> grid = new Grid<BeanModel>(store, cm);
grid.addPlugin(expander);
grid.addPlugin(re);
grid.getView().setForceFit(true);
cp.add(grid);

add(cp);


Here is a picture

http://snappydog.com/ExpanderVsEditor.png

Arno.Nyhm
29 Dec 2009, 9:38 AM
how was the solution for ExtJs? maybe you can do it similar in GXT ...

siberian
29 Dec 2009, 10:01 AM
Discussed here

http://www.extjs.com/forum/showthread.php?t=72485&highlight=Rowexpander+roweditor

Applying that via GXT is beyond me and its unclear if the Ext team ever integrated this fix or not.

sven
29 Dec 2009, 10:03 AM
You can cancel the BeforeEdit event of the roweditor if the target was the expand/collapse icon of the row.

iwarner
25 Mar 2010, 5:12 AM
Hi
Any chance you could give a little code pointer on this - trying to figure this out presently.
Appreciate your help on this
I will also post what I find
Cheers
Ian

siberian
25 Mar 2010, 11:03 PM
I ended up not needing this so never went all the way with it.

Sorry Ian!
John-


Hi
Any chance you could give a little code pointer on this - trying to figure this out presently.
Appreciate your help on this
I will also post what I find
Cheers
Ian

terciofilho
10 Jun 2010, 12:41 PM
Why don't you change the RowEditor clicksToEdit to Two?