【发布时间】:2014-02-07 22:48:59
【问题描述】:
我想要做的是: 我有一个 tableview,当我单击 tableviewrow 时,我希望禁用此 tableviewrow,因此您不能再次单击它以再次触发事件“单击”,但我希望您能够单击任何其他行表。
我试过了:
e.row.touchEnabled = false;
但它似乎不起作用。
希望你能帮助我。
谢谢^.^
这是 TableView 的代码
<TableView id="tableBuilding" allowsSelection="true">
<TableViewRow id="row" selectedBackgroundImage = "/images/bt_select_picker.png">
<ImageView id="imgBuilding"/>
<Label id="labBuilding" class="labelScroll" text="Building 01" />
<ImageView id="imgTransparent6" class="opacity"/>
<ImageView id="imgRemove6" class="remove" onClick="edit"/>
<ImageView id="imgHandle6" class="handle" onClick="handle"/>
</TableViewRow>
<TableViewRow id="row" selectedBackgroundImage = "/images/bt_select_picker.png">
<ImageView id="imgBuilding"/>
<Label id="labBuilding" class="labelScroll" text="Building 02" />
<ImageView id="imgTransparent7" class="opacity"/>
<ImageView id="imgRemove7" class="remove" onClick="edit"/>
<ImageView id="imgHandle7" class="handle" onClick="handle"/>
</TableViewRow>
<TableViewRow id="row" selectedBackgroundImage = "/images/bt_select_picker.png">
<ImageView id="imgBuilding"/>
<Label id="labBuilding" class="labelScroll" text="Building 03" />
<ImageView id="imgTransparent8" class="opacity"/>
<ImageView id="imgRemove8" class="remove" onClick="edit"/>
<ImageView id="imgHandle8" class="handle" onClick="handle"/>
</TableViewRow>
<TableViewRow id="row" selectedBackgroundImage = "/images/bt_select_picker.png">
<ImageView id="imgBuilding"/>
<Label id="labBuilding" class="labelScroll" text="Building 04" />
<ImageView id="imgTransparent9" class="opacity"/>
<ImageView id="imgRemove9" class="remove" onClick="edit"/>
<ImageView id="imgHandle9" class="handle" onClick="handle"/>
</TableViewRow>
<TableViewRow id="row" selectedBackgroundImage = "/images/bt_select_picker.png">
<ImageView id="imgBuilding"/>
<Label id="labBuilding" class="labelScroll" text="Building 05" />
<ImageView id="imgTransparent10" class="opacity"/>
<ImageView id="imgRemove10" class="remove" onClick="edit"/>
<ImageView id="imgHandle10" class="handle" onClick="handle"/>
</TableViewRow>
</TableView>
这里是事件监听器
$.tableBuilding.addEventListener('click', function(e) {
e.row.children[0].image = "/images/ic_selectedbuilding.png";
e.row.children[1].color = "white";
e.row.setTouchEnabled = false;
});
【问题讨论】:
-
能否发布您的代码,以便我们查看表、表行和事件侦听器是如何创建的。
标签: titanium titanium-mobile titanium-alloy