我有listGrid:
private com.smartgwt.client.widgets.grid.ListGrid listGrid;
listGrid = new ListGrid() {
@Override
protected Canvas createRecordComponent(final ListGridRecord record, Integer colNum) {
String fieldName = this.getFieldName(colNum);
if (fieldName.equals("toolStrip")) {
HLayout canvas = new HLayout();
canvas.setAlign(VerticalAlignment.TOP);
canvas.setAutoHeight();
ToolStrip strip = new ToolStrip();
strip.setAutoHeight();
strip.setAlign(Alignment.CENTER);
strip.setWidth(90);
strip.setHeight(25);
if (record.getAttributeAsBoolean("requireDoc") && !record.getAttributeAsBoolean("docProvided")) {
ToolStripButton requiredDocButton = new ToolStripButton();
requiredDocButton.setPrompt(conMess.notProvidedDocsPromt());
requiredDocButton.setIcon("attention.png");
strip.addButton(requiredDocButton);
} else {
strip.addSpacer(19);
}
ToolStripButton pdfButton = new ToolStripButton();
pdfButton.setPrompt(conMess.lookInPdf());
pdfButton.setIcon("pdf.png");
pdfButton.setCursor(Cursor.POINTER);
pdfButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
service.generatePdfUser(record.getAttributeAsString("type"), record.getAttributeAsDate("startDate"), record.getAttributeAsDate("endDate"),
record.getAttributeAsInt("numOfDays"), new AsyncCallback<Void>() {
public void onSuccess(Void result) {
String targetURL = GWT.getModuleBaseURL() + "PdfServlet";
Window.open(targetURL, "", null);
}
public void onFailure(Throwable caught) {
}
});
}
});
strip.addButton(pdfButton);
ToolStripButton deleteRecordButton = new ToolStripButton();
deleteRecordButton.setIcon("document_delete.png");
Date formStartDate = record.getAttributeAsDate("startDate");
if ((formStartDate.getMonth() > lastLockedMonth && formStartDate.after(currentDate)) || formStartDate.getYear() > currentDate.getYear()) {
deleteRecordButton.setDisabled(false);
deleteRecordButton.setPrompt(conMess.deleteForm());
deleteRecordButton.setCursor(Cursor.POINTER);
} else {
deleteRecordButton.setDisabled(true);
deleteRecordButton.setPrompt(conMess.deleteMessagePromt());
}
deleteRecordButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
SC.ask(conMess.deletingForm(), conMess.askingForDeleteVerification(), new BooleanCallback() {
public void execute(Boolean value) {
if (value) {
listGrid.removeData(record);
service.updateUserInfoOnRedraw(new AsyncCallback<User>() {
public void onSuccess(User result) {
redrawHeader();
}
public void onFailure(Throwable caught) {
GWT.log(caught.getMessage());
SC.say(caught.getMessage());
}
});
}
}
});
}
});
if (record.getAttributeAsInt("userId").equals(record.getAttributeAsInt("userCreatorId"))) {
strip.addButton(deleteRecordButton);
} else {
strip.addSpacer(20);
}
canvas.addMember(strip);
return canvas;
}
return null;
}
};
listGrid.setHeaderAutoFitEvent(AutoFitEvent.NONE);
listGrid.setWidth100();
listGrid.setShowHeaderContextMenu(false);
listGrid.setShowHeaderMenuButton(false);
listGrid.setAutoFetchData(false);
listGrid.setShowRecordComponents(true);
listGrid.setShowRecordComponentsByCell(true);
listGrid.setCanEdit(false);
listGrid.setLayoutAlign(Alignment.CENTER);
listGrid.setLeaveScrollbarGap(true); listGrid.setCellHeight(25);
dataSource = FormulaireDataSource.getInstance();
listGrid.setDataSource(dataSource);
listGrid.setFields(formId, userId, type, formSent, numOfDays, startDate, endDate, stage_one, stage_one_text, stage_two, stage_two_text, status, status_text, toolStrip, userCreatorId,
requireDoc, docProvided);
// dataSource.fetchData();
listGrid.fetchData();
listGrid.invalidateCache();
listGrid.setHeaderHeight(30);
listGrid.setCanResizeFields(false);
listGrid.sort("startDate", SortDirection.DESCENDING);
listGrid.setCanSort(true);
它在行listGrid.fetchData()上抛出此异常(来自上面的代码):
[ERROR] [Vacations] - 15:54:38.884:MDN9:WARN:Log:TypeError: this.setRowAriaState is not a function
Stack from error.stack:
GridBody.updateRowSelection() @ Vacations/sc/modules/ISC_Grids.js:689
GridRenderer._rowSelectionChanged() @ Vacations/sc/modules/ISC_Grids.js:557
GridRenderer._setSelectedObservation() @ Vacations/sc/modules/ISC_Grids.js:556
anonymous() @ Vacations/sc/modules/ISC_Core.js:49
Selection.select() @ Vacations/sc/modules/ISC_Grids.js:198
Selection.selectSingle() @ Vacations/sc/modules/ISC_Grids.js:198
Selection.selectOnMouseDown() @ Vacations/sc/modules/ISC_Grids.js:204
GridRenderer.selectOnMouseDown() @ Vacations/sc/modules/ISC_Grids.js:557
[a]MathFunction.invokeSuper() @ Vacations/sc/modules/ISC_Core.js:233
GridBody.selectOnMouseDown() @ Vacations/sc/modules/ISC_Grids.js:680
GridRenderer._cellMouseDown() @ Vacations/sc/modules/ISC_Grids.js:557
GridRenderer.mouseDown() @ Vacations/sc/modules/ISC_Grids.js:557
Canvas.handleMouseDown() @ Vacations/sc/modules/ISC_Core.js:2196
[c]EventHandler.bubbleEvent() @ Vacations/sc/modules/ISC_Core.js:1220
[c]EventHandler.doHandleMouseDown() @ Vacations/sc/modules/ISC_Core.js:1053
[c]EventHandler.handleMouseDown() @ Vacations/sc/modules/ISC_Core.js:1044
[c]EventHandler.dispatch() @ Vacations/sc/modules/ISC_Core.js:1252
anonymous() @ Vacations/sc/modules/ISC_Core.js:43
unnamed() @
我一般都无法运行该项目。是旧项目,它适用于: GWT 2.5.0 smartgwt 3.0
现在它是: GWT 2.6.0 smartgwt 4.0
我也尝试过使用smartgwt 5.0p但是没有加载SmartGWTEntryPoint或类似的东西。所有smartGWT版本都是LGPL版本。项目的主页正在加载,当我尝试转到listGrid时,我看到错误。在谷歌没有任何关于这个错误。我不知道还有什么要补充的。我确实尝试清理浏览器缓存,重新编译和调试很多次。请帮忙!
的.classpath:
<classpath>
<classpathentry kind="con" path="com.google.appengine.eclipse.core.GAE_CONTAINER/App Engine"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="test"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER/GWT"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/apache-poi-3.7.jar"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/appengine-api-1.0-sdk-1.9.25.jar"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/appengine-api-labs.jar"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/appengine-endpoints-deps.jar"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/appengine-endpoints.jar"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/appengine-jsr107cache-1.9.25.jar"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/gwt-cal-0.9.4.jar"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/gwt-dnd-3.3.0.jar"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/gwt-servlet.jar"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/itext-5.1.3.jar"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/jsr107cache-1.1.jar"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/junit-4.8.2.jar"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/mail-1.5.jar"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/mysql-connector-java-5.1.21.jar"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/smartgwt-skins.jar"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/smartgwt.jar"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/gwt-user-2.6.0.jar"/>
<classpathentry kind="output" path="war/WEB-INF/classes"/>
</classpath>
在使用GWT 2.7,smartGWT 5.0p,Google SDK 1.9.28,超级开发模式进行测试时,浏览器会加载空白页面。控制台的结果:
The code server is ready at http://127.0.0.1:9876/
Code server started in 26386 ms
waited 8843 ms for code server to finish
GET /recompile/Vacations
Job projectCongees.Vacations_2_0
starting job: projectCongees.Vacations_2_0
binding: locale=bg
Compiling module projectCongees.Vacations
Unification traversed 51666 fields and methods and 3737 types. 3702 are considered part of the current module and 3702 had all of their fields and methods traversed.
Compiling 1 permutation
Compiling permutation 0...
Linking per-type JS with 3686 new types.
prelink JS size = 10734929
prelink sourcemap = 10734929 bytes and 277033 lines
postlink JS size = 10632028
postlink sourcemap = 10632028 bytes and 274310 lines
Source Maps Enabled
Compile of permutations succeeded
Compilation succeeded -- 24.587s
Linking into /tmp/gwt-codeserver-3860455776220907037.tmp/projectCongees.Vacations/compile-2/war/Vacations; Writing extras to /tmp/gwt-codeserver-3860455776220907037.tmp/projectCongees.Vacations/compile-2/extras/Vacations
Link succeeded
Linking succeeded -- 3.424s
29.906s total -- Compile completed
答案 0 :(得分:1)
这似乎是版本不兼容问题,当您编译SmartGWT项目时,GWT编译器将一些.js文件复制到目标文件夹(在YOUR_MODULE_NAME/sc
目录下),尝试从中删除sc
文件夹您的Web应用程序并重新编译您的项目,然后让我知道您是否还有同样的问题。