PDA

View Full Version : AssertionError w/ RowEditor and Horizontal Scrolling of Grid



jdkida
30 Sep 2011, 10:23 AM
I have not noticed any thing actually being broken or not working, however when ever i create a grid that needs horizontal and vertical scrolling and I add in a RowEditor it causes an AssertionError in the Dev Mode log. However if I actually click on a row and open up the RowEditor i can then scroll with no problems but when i close it they come back again.

I am using Ext GWT 2.5

Any Ideas Here is my Grid Code.



public AccountTicketGridPanel(){

setLayout(new FitLayout());
createNewTicket = new CreateTicketWindow();
replyToTicket = new ReplyTicketWindow();
ToolBar topToolBar = new ToolBar();
Button create = new Button("Create Ticket");
create.setIconStyle("icon-email-add");
topToolBar.add(create);

create.addSelectionListener(new SelectionListener<ButtonEvent>() {


@Override
public void componentSelected(ButtonEvent ce) {
createNewTicket.getFormPanel().reset();
createNewTicket.setCorpAccountNumber(corpAcctNumber);
createNewTicket.show();
}

});


final Button reply = new Button("Reply");
reply.setEnabled(false);
reply.setIconStyle("icon-email-reply");
reply.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
replyToTicket.show();
}
});

topToolBar.add(reply);
setTopComponent(topToolBar);

// Create Grid Columns
final SimpleComboBox<String> comboDept = new SimpleComboBox<String>();
comboDept.setForceSelection(true);
comboDept.setTriggerAction(TriggerAction.ALL);
comboDept.add(getDepartments());

//Create Row Editor
RowEditor<Ticket> rowEdit = new RowEditor<Ticket>();

CellEditor departmentEditor = new CellEditor(comboDept) {
@Override
public Object preProcessValue(Object value) {
if (value == null) {
return value;
}
return comboDept.findModel(value.toString());
}
@Override
public Object postProcessValue(Object value) {
if (value == null) {
return value;
}
return ((ModelData) value).get("value");
}
};

final SimpleComboBox<String> comboPriority = new SimpleComboBox<String>();
comboPriority.setForceSelection(true);
comboPriority.setTriggerAction(TriggerAction.ALL);
comboPriority.add("High");
comboPriority.add("Medium");
comboPriority.add("Low");
comboPriority.add("Resolved");
comboPriority.add("In Progress");
comboPriority.add("Unknown");

CellEditor editorPriority = new CellEditor(comboPriority) {
@Override
public Object preProcessValue(Object value) {
if (value == null) {
return value;
}
return comboPriority.findModel(value.toString());
}

@Override
public Object postProcessValue(Object value) {
if (value == null) {
return value;
}
return ((ModelData) value).get("value");
}
};
TextField<String> titleText = new TextField<String>();
titleText.setAllowBlank(false);
List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
ColumnConfig ticketIDColumn = new ColumnConfig("ticketNumber", "Ticket #", 100);
ColumnConfig ticketlastUpdatedColumn = new ColumnConfig("lastUpdated", "Last Updated", 125);
ticketlastUpdatedColumn.setDateTimeFormat(DateTimeFormat.getFormat("MM/dd/yyyy hh:mm aa"));
ColumnConfig ticketTitleColumn = new ColumnConfig("title", "Title", 225);
ticketTitleColumn.setEditor(new CellEditor(titleText));
ColumnConfig ticketGroupColumn = new ColumnConfig("department", "Department", 115);
ticketGroupColumn.setEditor(departmentEditor);
ColumnConfig ticketAccountColumn = new ColumnConfig("corpAcctNumber", "Account #", 100);
ColumnConfig ticketIssueColumn = new ColumnConfig("issue", "Issue", 100);
ColumnConfig ticketPriorityColumn = new ColumnConfig("priority", "Priority", 75);
ticketPriorityColumn.setEditor(editorPriority);
ColumnConfig ticketCreatedDateColumn = new ColumnConfig("createDate", "Create Date", 125);
ticketCreatedDateColumn.setDateTimeFormat(DateTimeFormat.getFormat("MM/dd/yyyy hh:mm aa"));
columns.add(ticketIDColumn);
columns.add(ticketAccountColumn);
columns.add(ticketTitleColumn);
columns.add(ticketPriorityColumn);
columns.add(ticketIssueColumn);
columns.add(ticketlastUpdatedColumn);
columns.add(ticketGroupColumn);
columns.add(ticketCreatedDateColumn);
ColumnModel cm = new ColumnModel(columns);


// loader and store
itemStore = new ListStore<Ticket>();
Listener<RowEditorEvent> saveListener = new Listener<RowEditorEvent>(){
@Override
public void handleEvent(RowEditorEvent be) {
Dispatcher.forwardEvent(AppEvents.UpdateTicketHeader, itemStore.getAt(be.getRowIndex()));
}
};
rowEdit.addListener(Events.AfterEdit, saveListener);
//Create Grid
rowEdit.setClicksToEdit(ClicksToEdit.TWO);
grid = new Grid<Ticket>(itemStore,cm);
grid.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
grid.setAutoExpandColumn("title");
grid.setAutoExpandMin(150);


grid.getSelectionModel().addSelectionChangedListener(new SelectionChangedListener<Ticket>() {
@Override
public void selectionChanged(SelectionChangedEvent<Ticket> se) {
if (se.getSelection().size() > 0){
ticketItem = se.getSelectedItem();
showTicket(ticketItem);
replyToTicket.getFormPanel().reset();
replyToTicket.initializeFormFields(ticketItem);
reply.setEnabled(true);
}else{
reply.setEnabled(false);
}
}
});
ticketAccountColumn.setHidden(true);
grid.addPlugin(rowEdit);
add(grid);
}



Here is the error log.

java.lang.AssertionError: Method must be called after the component is rendered
at com.extjs.gxt.ui.client.widget.Component.assertAfterRender(Component.java:1503)
at com.extjs.gxt.ui.client.widget.Component.el(Component.java:405)
at com.extjs.gxt.ui.client.widget.grid.RowEditor.positionButtons(RowEditor.java:837)
at com.extjs.gxt.ui.client.widget.grid.RowEditor$1.handleEvent(RowEditor.java:252)
at com.extjs.gxt.ui.client.widget.grid.RowEditor$1.handleEvent(RowEditor.java:1)
at com.extjs.gxt.ui.client.event.BaseObservable.callListener(BaseObservable.java:178)
at com.extjs.gxt.ui.client.event.BaseObservable.fireEvent(BaseObservable.java:86)
at com.extjs.gxt.ui.client.widget.Component.fireEvent(Component.java:456)
at com.extjs.gxt.ui.client.widget.grid.GridView.syncScroll(GridView.java:1937)
at com.extjs.gxt.ui.client.widget.grid.GridView.handleComponentEvent(GridView.java:1208)
at com.extjs.gxt.ui.client.widget.grid.Grid.onComponentEvent(Grid.java:514)
at com.extjs.gxt.ui.client.widget.Component.onBrowserEvent(Component.java:884)
at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1321)
at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1277)
at sun.reflect.GeneratedMethodAccessor187.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:167)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326)
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:132)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:214)
at sun.reflect.GeneratedMethodAccessor185.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:167)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:281)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:531)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
at java.lang.Thread.run(Thread.java:662)

jdkida
30 Sep 2011, 12:00 PM
This appears to also happen on the Explorer Demo - Row Editor with a Vertical scrollbar.

http://www.sencha.com/examples/explorer.html#roweditorgrid

To stop the error from happening override RowEditor.positionButtons



RowEditor<ModelData> rowEdit = new RowEditor<ModelData>(){ protected void positionButtons() {
if(isRendered()){
super.positionButtons();
}
}
};


Credit to niloc132 for helping with the overide method

sven
1 Oct 2011, 1:35 AM
Thanks for reporting this issue. Its on the list now and i will inform you once its fixed.

sven
17 Oct 2011, 8:16 AM
http://www.sencha.com/forum/showthread.php?151180-FNR-RowEditor-error-when-scrolling-the-grid-if-RowEditor-not-rendered-yet.