Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Internet explorer GridPanel无法在Internet Explorer中获取行索引_Internet Explorer_Gwt - Fatal编程技术网

Internet explorer GridPanel无法在Internet Explorer中获取行索引

Internet explorer GridPanel无法在Internet Explorer中获取行索引,internet-explorer,gwt,Internet Explorer,Gwt,我正在挑选其他人的项目,当我尝试单击GridPanel中的一行时,仅在INTERNET EXPLORER中遇到错误。我能够获得正确显示在表上的数据,但当我单击行时,想要获得行索引以执行其他操作,我在IE7和IE8上的行索引得到null。FF、Chrome、Safari都没有问题 消息:“0”为空或不是对象 电话:10 字符:1601 代码:0 URI: 消息:“0”为空或不是对象 电话:10 字符:1601 代码:0 URI: 这是在gridPanel中生成值的代码: grid.getEl().

我正在挑选其他人的项目,当我尝试单击GridPanel中的一行时,仅在INTERNET EXPLORER中遇到错误。我能够获得正确显示在表上的数据,但当我单击行时,想要获得行索引以执行其他操作,我在IE7和IE8上的行索引得到null。FF、Chrome、Safari都没有问题

消息:“0”为空或不是对象 电话:10 字符:1601 代码:0 URI:

消息:“0”为空或不是对象 电话:10 字符:1601 代码:0 URI:

这是在gridPanel中生成值的代码:

grid.getEl().mask("Searching for codes, please wait...", true);
    AsyncCallback<LinkedHashMap<Long, Map>> acb = new AsyncCallback<LinkedHashMap<Long, Map>>() {

        public void onFailure(Throwable caught) {
             grid.getEl().unmask();
            MessageBox.alert("Failed :" + caught.getMessage());
        }

        public void onSuccess(LinkedHashMap<Long, Map> result) {

            Set key = result.entrySet();
            Iterator it = key.iterator();
             grid.setVisible(true);

            while (it.hasNext()) {
                Map.Entry en = (Map.Entry) it.next();
                Map m = (Map) en.getValue();
                String code = m.get("code").toString();
                try {

                    Date activationDate = new Date(Long.parseLong(m.get("activationtime").toString()));
                    Date deactivationDate = new Date(Long.parseLong(m.get("deactivationtime").toString()));
                    String actDateF = DateTimeFormat.getFormat("dd-MM-yyyy KK:mm:ss").format(activationDate);
                    String deactDateF = DateTimeFormat.getFormat("dd-MM-yyyy KK:mm:ss").format(deactivationDate);

                    Object[] obj = new Object[]{
                        actDateF,
                        deactDateF,
                        code
                    };


                    Record record = recordDef.createRecord(obj);
                     grid.getStore().add(record);

                } catch (Exception e) {

                    codeNotReading.add(code);
                    codeNotReading.add(e.getMessage());

                }
            }

            grid.getView().refresh();
            grid.getEl().unmask();
            if (codeNotReading.size() > 0) {
                MessageBox.alert(" \n Following code(s) cann't be added.  : " + codeNotReading.toString());
            }

        }
    };

有时,双击可能发生在GridPanel的内部和行单元格的外部。因此rowIndex将为null。我建议您在MessageBox.alertRow+rowIndex行上设置一个断点;并检查rowIndex是否为负或空

如果为负值或null,则将onCellDblClick的代码更改为以下内容:


我逐行调试并设法找出问题所在。这与GridPanel无关。这是在向单元格添加数据时尝试添加标记时出现的渲染问题。不知道为什么。
grid.addGridCellListener(new GridCellListenerAdapter() {

      @Override
        public void onCellDblClick(GridPanel grid, int rowIndex, int colIndex, EventObject e) {                
            MessageBox.alert("Row "+rowIndex);
        }
    });
if (rowIndex != null && rowIndex >= 0) {
    MessageBox.alert("Row "+rowIndex);
}