English 中文(简体)
Dojo JSON打电话回来,总是重复错误。
原标题:Dojo JSON call back always returns an error

我正在使用Dojo,并向AJAVA级发出呼吁,并试图将该方案的产出带给客户一个警示箱。

var showResult = function(result){
    console.log("Showing Result()");
    var store = new dojo.data.ItemFileReadStore({ data: result});
    console.dir(store);
            
    store.fetch( { onItem: function(data) {  alert("Hie"); },
        onError: function(error,request){ alert("ERROR");}
    });

};  

这是我的代码showResult。 基本上从<代码>xhr要求中召回功能。 页: 1 灭火器,但单壳功能总是回到<条码>。

我的储存阵列形式是{info=“试验电言”>,我需要检索“试验电文”,并在警示箱中展示。 任何帮助?

问题回答

如果result只是一个阵列,则你应使用new dojodata。 项目FileReadStore({数据:{项目:<>>>/code>以创建该仓库。

例如,result>[{info :“试验电1”},{info:“试验电2”},则该代码应为:

var store = new dojo.data.ItemFileReadStore({data : {items : result}});
store.fetch({
    onItem : function(item) {
        alert(store.getValue(item, "info"));
    },
    onError : function(error) {
        alert("Error!");
    }
});

提 出

store.fetch({query: {info:  * }},
    onItem: function(data) {
        alert("Hie");
    },
    onError: function(error, request) {
        alert("ERROR");
    }
);

以及您可能希望看到:<代码>onComplete:Function(items){console.log(项目);} 不是onItem,而是值得尝试。

以及<条码>console.log 您的错误,以便你能够看到问题是什么。

你们储存的一些其他物品都有识别和标签?





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签