【发布时间】:2015-07-31 14:04:10
【问题描述】:
我正在尝试向表中添加一行。该表是用合金创建的,我正在尝试从 js 中追加行。
这里是xml
<Alloy>
<Window id='index' class="container">
<TableView id="MainThings">
<TableViewSection id='MainThingsSection'>
</TableViewSection>
</TableView>
<Label id="AddCounter" onClick="doClick">+</Label>
<Label id="clear" onClick="clear">-</Label>
</Window>
这是.js
function Loader(){
var row= Titanium.UI.createTableViewRow({
title:'Title'
});
$.MainThingsSection.append(row);
}$.MainThings.addEventListener('open',Loader());
$.index.open();
这是错误
[ERROR] : Script Error {
[ERROR] : backtrace = "#0 () at file:///Users/stephenhanrahan/Library/Developer/CoreSimulator/Devices/C088B99B-2086-4FA3-AABD-85E2B4BE3944/data/Containers/Bundle/Application/A8E9395F-44CF-4699-92EC-9638E2473142/I%20Have%20This%20Many.app/alloy.js:265";
[ERROR] : line = 93;
[ERROR] : message = "Invalid type passed to function";
[ERROR] : nativeLocation = "-[TiProxy addEventListener:] (TiProxy.m:824)";
[ERROR] : nativeReason = "expected: Function, was: NSNull";
[ERROR] : sourceId = 286306016;
[ERROR] : sourceURL = "file:///Users/stephenhanrahan/Library/Developer/CoreSimulator/Devices/C088B99B-2086-4FA3-AABD-85E2B4BE3944/data/Containers/Bundle/Application/A8E9395F-44CF-4699-92EC-9638E2473142/I%20Have%20This%20Many.app/alloy/controllers/index.js";
[ERROR] : }
【问题讨论】:
标签: javascript uitableview appcelerator titanium-alloy