无法实现$ .data.promise

时间:2013-11-21 10:25:32

标签: jaydata

当我集成2个模块时,我收到以下错误:

未实施!:$ data.Promise.then

我花了两天的时间在它上面工作。在本地服务器上工作但是在我的本地系统上这个错误即将到来。

这是我的代码:

function getSelectedGridData(viewId,filterId,groupId){

    // Declaration of variables
    var resultArray=[];
    var viewFieldArray=[];
    var headerArray=[];
    var headerString="";
    var groupString="";
    var innerFilterString="";
    var outerFilterString="";
    var swapFilter="";

    offlinedb.view.toArray(function (View) {
       ................some code...........
                // Fetch data from table 'document_header' and convert entity set into array
                offlinedb.document_headers.toArray(function (header){
                    ......some code............
                    });
    }).then(function (startGroup){
        offlinedb.grouping.toArray(function (Group) {
            ...some code.....                       
        }).then(function (startFilter){
            offlinedb.filters.toArray(function (Filter) {
                   ..some code............
            sqlitedb.transaction(function (sqliteTransation) {
                ...some code.....
            });
        });
});
}); 
}

我的错误是:

Not implemented!: $data.Promise.then

Exception {name: "Not implemented!", message: "$data.Promise.then", data: undefined, _getStackTrace: function}
 jaydata.js:1880
Guard.raise jaydata.js:1880
$data.Class.define.then jaydata.js:9239
getSelectedGridData common.js:72
(anonymous function) common.js:348
Uncaught Not implemented!: $data.Promise.then 

2 个答案:

答案 0 :(得分:0)

你需要一个promise库,jquery或q

答案 1 :(得分:0)

按照显示的顺序放置它,它会起作用

<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
<script src="http://include.jaydata.org/jaydata.js"></script>