Titanium Layout not working while set touchEnabled=false inside Listview - titanium

When I set touchEnabled="false" for a view which was inside my List view template all my list view layout was broken. when i remove the touch enabled property it working fine. Anyone please help me to solve this issue.
Titanium SDK : 3.4.0 ,
OS : IOS and android,
Here is my sample code.
<Alloy>
<Window backgroundColor="#fff">
<ListView id="LstView" top="50" defaultItemTemplate="template1">
<Templates >
<ItemTemplate id="mytemplate" name="template1">
<View layout="horizontal" width="Ti.UI.FILL" touchEnabled="false">
<View width="Ti.UI.SIZE" height="Ti.UI.SIZE" left="5">
<Label bindId="Lbl1" Id="Lbl1" color="black"></Label>
</View>
<View width="Ti.UI.SIZE" height="Ti.UI.SIZE" left="10" >
<Label bindId="Lbl2" Id="Lbl2" color="black"></Label>
</View>
<View width="Ti.UI.SIZE" height="Ti.UI.SIZE" left="10">
<Label bindId="Lbl3" Id="Lbl3" color="black" ></Label>
</View>
</View>
</ItemTemplate>
</Templates>
<ListSection>
<ListItem Lbl1:text="hello" Lbl2:text="how are you?" Lbl3:text="I am fine" height='70'/>
</ListSection>
</ListView>
</Window>
</Alloy>

According to this article touchEnabled = false will forward the touch event to it's peers. Can you show your whole xml file? I can't clarify anything yet..

it seems a titanium bug.. open a ticket in JIRA.. Jira Bug Report

Related

How to keep a button behind virtual keyboard?

When the virtual keyboard appears, I want to keep the button behind it, not jumping up to the top of the keyboard. How to achieve this? Here is the layout I have:
<>
<FlatList />
<Button />
</>
This way the button will stick on the bottom
<View style={{flex:1}}>
<FlatList contentContainerStyle={{flex:1}}/>
<Button />
<View/>

Appcelerator Alloy TableView click event is not firing up on parent tableview

Im building a app that i have a tableview inside a tableview row.
i have a click event in the main tableview, that i wish to keep.
<Alloy>
<Collection src="orders" />
<Window onAndroidback="closeWindow" id="activeorderswindow" class="maincontainer_noactionbar">
<View class="topcontainer">
<ImageView class="topbackbutton" onClick="closeWindow"></ImageView>
<Label class="topheadinglabel">Aktive ordre</Label>
<ImageView class="topmenubutton" onClick="closeWindow"></ImageView>
</View>
<View class="maindatacontainer">
<TableView class="orderstable" id="activeorderstable" dataTransform="transformFunction" dataCollection="orders" dataFunction="updateUI" onDragEnd="refreshTable" >
<!-- Also can use Require -->
<TableViewRow class="activeordersrow" oid="{oid}" touchEnabled="true" >
<Label class="rowOid" text="{oid}"/>
<Label class="rowCust" text="{cust}"/>
<Label class="rowScode" text="{scode}"/>
<Label class="rowVehicle" text="{vehicle}"/>
<Label class="rowOrdertime" text="{ordertime}"/>
<ImageView class="imgOrdertime" image='/images/clock_green.png'/>
<ImageView class="imgDeadline" image='/images/clock_red.png'/>
<Label class="rowDeadline" text="{deadline}"/>
<View class="addresstablewrapper" backgroundColor="#000"/>
<TableView touchEnabled="false" scrollType="vertical" class="activeorders_addresses" data="{orders_addresses}" backgroundColor="yellow" />
</TableViewRow>
</TableView>
</View>
</Window>
The problem is that because i have another within the table with its own rows (without a click event) it seems like the click on the main does not fire.
Help appreciated :)
Thanks
Tom
Maybe the nested TableView should have touchEnabled="true" so the click bubbles up to the parent (tableviewrow).

Titanium appcelerator how to update view inside listview?

I have an Appcelerator Titanium app to do, i have a Ti.UI.ListView with a view inside (view_one.xml):
...
<ListView onItemclick="getEvaluation" id="myLisview" defaultItemTemplate="templateLm" bottom="0" top="10" onItemclick="changePage" backgroundColor="white">
<Templates>
<Require id="lm_items" src="common/templateLm"/>
</Templates>
</ListView>
...
in common/templateLm :
<Alloy>
<ItemTemplate name="templatePageMission">
<View bindId="evaluate" height="10dp">
<Label text="evaluate"></Label>
</View>
<View bindId="stars" height="15dp"/>
</ItemTemplate>
</Alloy>
in view_one.js :
function getEvaluation(e){
switch(e.bindId){
case 'evaluate':
var item = e.section.getItemAt(e.itemIndex);
console.log(item) // <= this is empty ????
item.stars.backgroundColor = "red";
break;
}
}
and when click on the evaluate view I finally got:
undefined is not an object (evaluating item.stars.backgroundColor)
If anyone can help, this is great, anyway thanks for this great community.
You have assigned the itemclick event twice:
onItemclick="changePage"
and
onItemclick="getEvaluation"
So if you just use the latter one, it should catch the controller function correctly and the item should be updated correctly, since your controller code looks valid.

Titanium display image on xml from local

I was storing the full path of an image & retrieved it below, I want to know why does this image file path,doesn't display in imageview on xml?
file://localhost/Users/rhez/Library/Application%20Support/iPhone%20Simulator/6.1/Applications/76BDE731-037A-43F8-997B-DAFCA6E0D509/Documents/1372402304473-ea.jpg
<TableView dataCollection="photos">
<TableViewRow id="row" dataId="" model="{id}">
<View id="holderview">
<ImageView id="imageview" url="{path}"></ImageView>
</View>
</TableViewRow>
</TableView>
However as I view in the finder where the application project documents is located the image is stored in there.Is there something wrong on displaying/retrieving on my xml? Thanks for all your courage in helping.
Try setting the image property, not url, url is deprecated.
<TableView dataCollection="photos">
<TableViewRow id="row" dataId="" model="{id}">
<View id="holderview">
<ImageView id="imageview" image="{path}"></ImageView>
</View>
</TableViewRow>
</TableView>

dynamic data for each TableViewRow

I'm using alloy (markup and models) to construct a tableview, Everything works perfect
<Collection src="spot" />
<Window>
<TableView id="spotTableView" dataCollection="spot">
<TableViewRow title="{name}">
<View class="header-view">
<Label class="title-header" text="{name}"/>
<Label class="desc-header" text="{desc}"/>
</View>
<View class="fixed-view">
<ImageView class="image" image="{logo}"/>
<View class="info-view">
<Label class="green-label" text="{cost}"/>
<Label text="{minimum}"/>
</View>
</View>
</TableViewRow>
</TableView>
</Window>
But I have a question: How I can modify dynamic data form for each tableviewrow? I need to change the colors of the labels depending on the data that brings each model in the collection. For example, if the cost is 0 that the label "cost" is green, but if the cost is 100 then the color of the label is red.
I guess this must realizarce on the controller, but I would not like create the tableviewrow out of view, because they do not want to miss the advantages of data bindings
Add a field containing the color to the model, and bind the label's color to it.