PDA

View Full Version : Checkbox closes RowExpander in Grid



siberian
5 Jan 2010, 12:11 AM
I have a Paging Grid with a RowExpander present.

In my case, when the row expands, I am creating a panel rather then sending it a template. I need a form in the expansion..


expander = new ExtendedRowExpander() {
java.util.Map<El, PolicyDetail> layouts = new java.util.HashMap();

@Override
protected boolean beforeExpand(ModelData model, Element body, El row, int rowIndex) {
Info.display("EXPAND","Got ExpandRow?");
if (fireEvent(Events.BeforeExpand)) {
return makePanel(body, row, rowIndex);
}
return false;
}

@Override
protected void collapseRow(El row) {
Info.display("COLLAPSE","Got CollapsesRow?");
if (fireEvent(Events.BeforeCollapse)) {
row.replaceStyleName("x-grid3-row-expanded", "x-grid3-row-collapsed");
// Detach so we don't bleed memory
ComponentHelper.doDetach(layouts.get(row));
layouts.remove(row);
fireEvent(Events.Collapse);
} else {
}
}

protected boolean makePanel(Element body, El row, int rowIndex) {
PolicyDetail theDetail = new PolicyDetail(row, grid, rowIndex, (BeanModel) store.getAt(rowIndex));
layouts.put(row, theDetail);
body.setInnerHTML("");
layouts.get(row).render(body);
ComponentHelper.doAttach(layouts.get(row));
return true;
}

};
columns.add(expander);

Works great! However in the 'PolicyDetail' panel I have some checkboxes.

IF I call setName on a checkbox the resulting checkbox, when clicked, closes the expanded row.

it fires no events that I can detect. It just closes.

Removing the call to setName makes this problem go away (but then messes up my FormBinding).

Maybe I am using this feature wrong, not sure, but it seems odd that setName toggles this behavior.

Arno.Nyhm
5 Jan 2010, 9:12 AM
in this case it is the best to post a full working example which shows the problem in one class (including the EntryPoint). also post with your code the class for ExtendedRowExpander - all customized things can make this problem.

PS:
it would be also nice if you make your rowexpander with custom widget more generic as a own class :-)
maybe something like the gridcellrenderer but for rowexpaner...

EDIT:

i added a generic RowExpander with GridCellRenderer in this thread
http://www.extjs.com/forum/showthread.php?p=424451#post424451