【问题标题】:GWT , SmartGWT error: setRowAriaState is not a functionGWT,SmartGWT 错误:setRowAriaState 不是函数
【发布时间】:2015-12-01 00:14:11
【问题描述】:

我有 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

【问题讨论】:

    标签: gwt smartgwt


    【解决方案1】:

    这似乎是版本不兼容的问题,当你编译一个 SmartGWT 项目时,GWT 编译器将一些 .js 文件复制到你的目标文件夹(在YOUR_MODULE_NAME/sc 目录下),尝试从你的 web 应用程序中删除 sc 文件夹并重新编译你的项目,如果你还有同样的问题,请告诉我。

    【讨论】:

    • 删除 Vacation/sc 和删除 gwt-UnitCache 都没有帮助。我删除了这些文件夹,右键单击,Google-> GWT 编译。有两个错误:
    • Errors in 'com/smartgwt/client/bean/types/EnumValueType.java' 第 26 行:名称冲突:EnumValueType 类型的方法 registerValueType(Class) 具有相同的擦除as registerValueType(Class) of type OtherValueType 但不隐藏它 'com/smartgwt/client/bean/types/JsoValueType.java' 中的错误 第 31 行:名称冲突:方法 registerValueType(Class ) 类型的 JsoValueType 与其他类型的 registerValueType(Class) 具有相同的擦除 OtherValueType 但不隐藏它
    • 但是工程编译好了。之后通过 -> 调试 -> GWT 经典开发模式运行项目。登录页面正在加载,然后我登录,然后导航到带有列表网格的页面后,我看到了问题中的错误。正在加载主题。如果你愿意,我会尝试在 bit bucket 中分享项目?
    • 您确定要在项目构建路径中使用新的 GWT 和 SmartGWT jar 文件进行编译吗?如果是,请在超级开发模式下重试
    • 超级开发模式将整个客户端代码编译为 javascript 然后运行它。因此,与已弃用的经典模式(大多数浏览器不再支持)不同,它没有客户端调试功能,当您拥有复杂的客户端应用程序时,这是一个非常大的问题。因此,请尝试以详细模式(而不是混淆模式)编译您的项目,并使用 try catch 块围绕容易出错的代码部分,它可能会帮助您找到错误源。
    猜你喜欢
    • 1970-01-01
    • 2012-02-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-01
    相关资源
    最近更新 更多