PDA

View Full Version : LiveGridView crashes browser when resized



sri2k1us
30 Jul 2012, 12:36 PM
GWT: 2.4.0

GXT: 2.2.5

Firefox: 13.0.1

Chrome: 20.0.1132.57

OS: Mac OS X Lion 10.7.4 (11E53)

Java: 1.6.0_33

Using GXT 2.2.5, resizing a LiveGridView can cause the JVM to crash. We've tested this in both Firefox and Google Chrome (versions shown above).



We are attempting to create a window which contains a LiveGridView, and this window should be resizable by the user.



The crash will only occur if the LiveGridView instance has force fit, auto fill, or both set to true. The attached project was constructed to replicate the issue.

In the click handler for the button, a Window is constructed. Overriding the Window's onRender method, the LiveGridView sample code taken from the 2.2.5 demo explorer was placed inside.


Now, to recreate the issue:
1. In eclipse, start the sample project (debug mode or not)
2. Open up the demo in the browser and click the "Open LiveGridView in Window" button.
3. Wait for the window and LiveGridView to load, then resize the window (resize the window, not the browser)


We have tried to adjust the column configs as well as other layouts, but we are unable to create a simple resizable Window which contains a LiveGridView.


/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class LiveGridViewResizeTest implements EntryPoint {

/**
* This is the entry point method.
*/
@Override
public void onModuleLoad() {
final Button openLiveGridViewButton = new Button("Open LiveGridView in Window");

// We can add style names to widgets
openLiveGridViewButton.addStyleName("openLiveGridViewButton");

// Add the nameField and openLiveGridViewButton to the RootPanel
// Use RootPanel.get() to get the entire body element
RootPanel.get("openLiveGridViewButtonContainer").add(openLiveGridViewButton);

// Create the Window with LiveGridView Example

// Create a handler for the openLiveGridViewButton and nameField
class MyHandler implements ClickHandler {
/**
* Fired when the user clicks on the openLiveGridViewButton.
*/
@Override
public void onClick(ClickEvent event) {
Window window = new Window() {
@Override
protected void onRender(Element parent, int index) {
super.onRender(parent, index);

setLayout(new FitLayout());
String url = "http://www.extjs.com/forum/topics-browse-remote.php";
ScriptTagProxy<PagingLoadResult<ModelData>> proxy = new ScriptTagProxy<PagingLoadResult<ModelData>>(
url);

ModelType type = new ModelType();
type.setRoot("topics");
type.setTotalName("totalCount");
type.addField("title");
type.addField("forumtitle");
type.addField("forumid");
type.addField("author");
type.addField("replycount");
type.addField("lastposter");
type.addField("excerpt");
type.addField("replycount");
type.addField("threadid");

DataField datefield = new DataField("lastpost");
datefield.setType(Date.class);
datefield.setFormat("timestamp");
type.addField(datefield);

JsonPagingLoadResultReader<PagingLoadResult<ModelData>> reader = new JsonPagingLoadResultReader<PagingLoadResult<ModelData>>(
type);

final PagingLoader<PagingLoadResult<ModelData>> loader = new BasePagingLoader<PagingLoadResult<ModelData>>(
proxy, reader);

loader.addListener(Loader.BeforeLoad, new Listener<LoadEvent>() {
@Override
public void handleEvent(LoadEvent be) {
BasePagingLoadConfig m = be.<BasePagingLoadConfig> getConfig();
m.set("start", m.get("offset"));
m.set("ext", "js");
m.set("lightWeight", true);
m.set("sort", (m.get("sortField") == null) ? "" : m.get("sortField"));
m.set("dir",
(m.get("sortDir") == null || (m.get("sortDir") != null && m
.<SortDir> get("sortDir").equals(SortDir.NONE))) ? ""
: m.get("sortDir"));
}
});
loader.setSortDir(SortDir.DESC);
loader.setSortField("lastpost");

loader.setRemoteSort(true);

ListStore<ModelData> store = new ListStore<ModelData>(loader);

List<ColumnConfig> columns = new ArrayList<ColumnConfig>();

ColumnConfig title = new ColumnConfig("title", "Topic", 100);
title.setRenderer(new GridCellRenderer<ModelData>() {

@Override
public Object render(ModelData model, String property, ColumnData config,
int rowIndex, int colIndex, ListStore<ModelData> store,
Grid<ModelData> grid) {
return "<b><a style=\"color: #385F95; text-decoration: none;\" href=\"http://extjs.com/forum/showthread.php?t="
+ model.get("threadid")
+ "\" target=\"_blank\">"
+ model.get("title")
+ "</a></b><br /><a style=\"color: #385F95; text-decoration: none;\" href=\"http://extjs.com/forum/forumdisplay.php?f="
+ model.get("forumid")
+ "\" target=\"_blank\">"
+ model.get("forumtitle") + " Forum</a>";
}

});
columns.add(title);
columns.add(new ColumnConfig("replycount", "Replies", 50));

ColumnConfig last = new ColumnConfig("lastpost", "Last Post", 200);
last.setRenderer(new GridCellRenderer<ModelData>() {

@Override
public Object render(ModelData model, String property, ColumnData config,
int rowIndex, int colIndex, ListStore<ModelData> store,
Grid<ModelData> grid) {
return model.get("lastpost") + "<br/>by " + model.get("lastposter");
}

});
columns.add(last);

ColumnModel cm = new ColumnModel(columns);

final Grid<ModelData> grid = new Grid<ModelData>(store, cm);
grid.setBorders(true);
grid.setAutoExpandColumn("title");
grid.setLoadMask(true);
grid.setStripeRows(true);

LiveGridView liveView = new LiveGridView();
liveView.setEmptyText("No rows available on the server.");
liveView.setRowHeight(32);
liveView.setForceFit(true);
grid.setView(liveView);

ContentPanel panel = new ContentPanel();
panel.setFrame(true);
panel.setCollapsible(true);
panel.setAnimCollapse(false);
// panel.setIcon(Resources.ICONS.table());
panel.setHeading("LiveGrid Grid");
panel.setLayout(new FitLayout());
panel.add(grid);
panel.setSize(600, 350);
grid.getAriaSupport().setLabelledBy(panel.getHeader().getId() + "-label");

ToolBar toolBar = new ToolBar();
toolBar.add(new FillToolItem());

LiveToolItem item = new LiveToolItem();
item.bindGrid(grid);

toolBar.add(item);
panel.setBottomComponent(toolBar);

add(panel);

}
};

window.show();
}
}

// Add a handler to send the name to the server
MyHandler handler = new MyHandler();
openLiveGridViewButton.addClickHandler(handler);
}
}

sven
30 Jul 2012, 9:52 PM
You are saying that the JVM crashes. This means that the application runs fine when compiled?

sri2k1us
31 Jul 2012, 7:55 AM
@Sven - I meant to say that my browser was killed.

sven
31 Jul 2012, 8:19 AM
So you have this issue also in production mode and not only in development mode when running java code?

sri2k1us
31 Jul 2012, 8:50 AM
Yes thats right. Both in development mode and in production mode, the browser is killed as soon i try to resize my window that contains the live grid.

sven
31 Jul 2012, 8:52 AM
I will move this thread to the bugs forum so we can take a look at it. Thanks for reporting.

sarsipius
23 Aug 2012, 3:16 AM
hi,

I have the same issue.

do you have some news about the bug resolution?

thanks

sri2k1us
23 Aug 2012, 3:40 PM
Nothing. We are going to try it out in GXT 3.0

Auz
4 Sep 2012, 10:11 PM
I have the same issue.
My browser will crash when my liveGrid with a liveGridView is resized.
This occurs in IE8, Firefox 3.6 and Chrome 21 in hosted dev mode and compiled mode.
I am using GXT 2.2.5 / GWT 2.2.0
Is there a workaround or fix?

sarsipius
5 Sep 2012, 6:52 AM
the crash is due to this line : liveView.setForceFit(true);


do you think the 3.0 resolves this bug?