Created
August 12, 2016 01:54
Star
You must be signed in to star a gist
Titanium Master Detail Basic Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This is your global styles file. Selectors and rules you define | |
here will be applied throughout your app. However, these rules | |
have the lowest priority of any style settings. | |
For more information, see the "Style Priorities" section of | |
http://docs.appcelerator.com/platform/latest/#!/guide/Alloy_Styles_and_Themes | |
For example, the following would apply to all labels, windows, | |
and text fields (depending on platform) in your app unless you | |
overrode the settings with other TSS, XML, or JS settings: | |
'Label[platform=android,windows]': { | |
color: '#000' // all platforms except Android and Windows default to black | |
} | |
'Window': { | |
backgroundColor: '#fff' // white background instead of default transparent or black | |
} | |
'TextField[platform=android]': { | |
height: Ti.UI.SIZE | |
} | |
*/ | |
'Window': { | |
backgroundColor: '#fff' // white background instead of default transparent or black | |
} | |
'TableViewRow': { | |
hasChild: true, | |
height: 44, | |
color: 'black' | |
} | |
'Label': { | |
color: '#000' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function closeWindow(){ | |
$.detailWin.close(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
".container" : { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Alloy> | |
<Window id="detailWin" title="Detail"> | |
<!-- <Button onClick="closeWindow">Close Window</Button> --> | |
<Label>Detail Data</Label> | |
</Window> | |
</Alloy> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function openDetail(e) { | |
var detailWin = Alloy.createController('detail').getView(); | |
if(OS_IOS) { | |
$.navWin.openWindow(detailWin); | |
} else if(OS_ANDROID) { | |
detailWin.open(); | |
detailWin.addEventListener('open',function(evt){ | |
var activity=detailWin.activity; | |
activity.actionBar.displayHomeAsUp=true; | |
activity.actionBar.setHomeButtonEnabled(false); | |
activity.actionBar.onHomeIconItemSelected=function(){ | |
evt.source.close(); | |
}; | |
}); | |
} | |
} | |
if(OS_IOS) { | |
$.navWin.open(); | |
} else if(OS_ANDROID) { | |
$.win1.open(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
".container": { | |
backgroundColor:"white" | |
} | |
"Label": { | |
width: Ti.UI.SIZE, | |
height: Ti.UI.SIZE, | |
color: "#000" | |
} | |
"#label": { | |
font: { | |
fontSize: 12 | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Alloy> | |
<NavigationWindow id="navWin" platform="ios"> | |
<Window id="win1" title="Master"> | |
<!-- <Button id="button" onClick="openDetail">Open Detail</Button> --> | |
<TableView> | |
<TableViewRow title='Row 1' onClick="openDetail" /> | |
<TableViewRow title='Row 2' onClick="openDetail" /> | |
<TableViewRow title='Row 3' onClick="openDetail" /> | |
<TableViewRow title='Row 4' onClick="openDetail" /> | |
<TableViewRow title='Row 5' onClick="openDetail" /> | |
</TableView> | |
</Window> | |
</NavigationWindow> | |
<Window id="win1" title="Master" platform="android"> | |
<!-- <Button id="button" onClick="openDetail">Open Detail</Button> --> | |
<TableView> | |
<TableViewRow title='Row 1' onClick="openDetail" /> | |
<TableViewRow title='Row 2' onClick="openDetail" /> | |
<TableViewRow title='Row 3' onClick="openDetail" /> | |
<TableViewRow title='Row 4' onClick="openDetail" /> | |
<TableViewRow title='Row 5' onClick="openDetail" /> | |
</TableView> | |
</Window> | |
</Alloy> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment