0

该模型:

exports.definition = {
    config: {
        "columns": {
            "id":"INTEGER PRIMARY KEY AUTOINCREMENT",
            "title":"TEXT",
            "file":"TEXT UNIQUE",
            "desc":"TEXT",
            "media":"TEXT",
            "type":"TEXT"
        },
        "adapter": {
            "type": "sql",
            "collection_name": "downloads",
            "db_name":"downloads.db",
            "idAttribute":"id"
        }
    },

    extendModel : function(Model) {
        _.extend(Model.prototype, {
        });

        return Model;
    },

    extendCollection : function(Collection) {
        _.extend(Collection.prototype, {
        });

        return Collection;
    }
};

请注意,该列idautoincrement

风景:

<ListItem title:text="{title} - {media}" subtitle:text="{desc}" itemId="{id}" />

请注意,它绑定到id列。

如果我在没有指定的情况下调用以下内容id(我不必这样做。它是自动递增的):

collection.create({title:'title',desc:'desc',file:'file',media:'media',type:'type'});

我收到一个错误:

[ERROR] :  Script Error {
[ERROR] :      column = 10;
[ERROR] :      line = 4;
[ERROR] :      message = "Can't find variable: id";
[ERROR] :      stack = "anonymous\ntemplate@file:///var/mobile/Containers/Bundle/Application/7C3527BC-5AC3-4CF0-974D-58F4C5717601/FRCC.app/alloy/underscore.js:1:13899\nt@file:///var/mobile/Containers/Bundle/Application/7C3527BC-5AC3-4CF0-974D-58F4C5717601/FRCC.app/alloy/controllers/download.js:1:1326\ntrigger@file:///var/mobile/Containers/Bundle/Application/7C3527BC-5AC3-4CF0-974D-58F4C5717601/FRCC.app/alloy/backbone.js:1:1353\n_onModelEvent@file:///var/mobile/Containers/Bundle/Application/7C3527BC-5AC3-4CF0-974D-58F4C5717601/FRCC.app/alloy/backbone.js:1:9447\ntrigger@file:///var/mobile/Containers/Bundle/Application/7C3527BC-5AC3-4CF0-974D-58F4C5717601/FRCC.app/alloy/backbone.js:1:1441\nadd@file:///var/mobile/Containers/Bundle/Application/7C3527BC-5AC3-4CF0-974D-58F4C5717601/FRCC.app/alloy/backbone.js:1:6798\ncreate@file:///var/mobile/Containers/Bundle/Application/7C3527BC-5AC3-4CF0-974D-58F4C5717601/FRCC.app/alloy/backbone.js:1:8655\nfile:///var/mobile/Containers/Bundle/Application/7C3527BC-5AC3-4CF0-974D-58F4C5717601/FRCC.app/downloadmanager.js:1:481";
[ERROR] :  }

这只是在升级之后。任何的想法?一个错误或某些东西从我的角度破坏了?

谢谢。

4

1 回答 1

1

你遇到了一个错误。希望是我们在 Alloy 数据绑定中解决的一系列错误中的最后一个。请注意并关注进度,因为我将立即修复此错误.. 现在

https://jira.appcelerator.org/browse/ALOY-1477

于 2016-03-29T10:11:00.423 回答