【发布时间】:2015-02-26 19:44:56
【问题描述】:
我正在尝试使用 Alloy 框架仅删除一条记录:
我在我的控制器 .js 中创建了这段代码来显示我从 ListView 获得的变量:
var args = arguments[0] || {};
$.titleLabel.text = args.titulo || 'Default Title';
$.authorLabel.text = args.author || 'Default Author';
我已经创建了这个删除功能:
function deleteBook(){
var books = Alloy.createCollection('books');
// The table name is the same as the collection_name value from the 'config.adapter' object. This may be different from the model name.
var table = books.config.adapter.collection_name;
// use a simple query
books.fetch({query:'Delete from ' + table + ' where titulo="' + args.titulo + '"'});
}
我用一个按钮调用了这个函数,但是我得到了这个错误:
[ERROR] : TiExceptionHandler: (main) [359476,359476] ----- Titanium Javascript Runtime Error -----
[ERROR] : TiExceptionHandler: (main) [0,359476] - In alloy/sync/sql.js:1,69
[ERROR] : TiExceptionHandler: (main) [0,359476] - Message: Uncaught TypeError: Cannot call method 'isValidRow' of null
[ERROR] : TiExceptionHandler: (main) [0,359476] - Source: (o)?r.execute(o):r.execute(o.statement,o.params);for(var c=0,u=[];d.isValidRow
[ERROR] : V8Exception: Exception occurred at alloy/sync/sql.js:1: Uncaught TypeError: Cannot call method 'isValidRow' of null
我只是希望能够从我的数据库中删除记录。
【问题讨论】:
标签: javascript android titanium titanium-alloy sql-delete