I am facing a suspicious issue which can't be logically true. On Saving model the some elements in tablerow hides.
Here is the view code noteRow.xml
<Alloy>
<TableViewRow id="noteRow">
<View class="noteRowSeperator"></View>
<View id="noteRowContainer">
<View class="noteSideBox">
<ImageView id="noteStatus" onClick="toggleStatus"></ImageView>
</View>
<View class="noteContentBox">
<Label class="noteDescription" text="{description}"/>
</View>
</View>
<View class="noteRowSeperator"></View>
</TableViewRow>
</Alloy>
Here is the controller code noteRow.js
var moment = require('alloy/moment');
var id;
if ($model) {
id = $model.id;
if ($model.get('done')) {
$.noteRowContainer.opacity = 0.5;
$.noteStatus.image = '/images/status_completed.png';
} else {
$.noteRowContainer.opacity = 1;
$.noteStatus.image = '/images/status_not_completed.png';
}
}
function toggleStatus(e) {
alert(id);
var note = Alloy.Collections.note.get(id);
note.set({
"done": note.get('done') ? 0 : 1,
"completed_at": moment().format('X'),
"updated_at": moment().format('X')
}).save();
}
When the model saves the all ImageView
with id noteStatus
simply hides on all tablerows in tableview. Can't figure out why its having the issue. Please guide me to sort it.
Application type: Mobile Titanium SDK: 3.1.2 Platform: Android (Gynemotion) (Also on my device Galaxy SII) Platform Version: 4.1.1