Skip to content

Instantly share code, notes, and snippets.

@hansemannn
Created December 20, 2015 22:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hansemannn/9c05d720e9f5af0f958d to your computer and use it in GitHub Desktop.
Save hansemannn/9c05d720e9f5af0f958d to your computer and use it in GitHub Desktop.
Ti.UI.iOS.PreviewContext with depending data
var window = Ti.UI.createWindow();
var context = Ti.UI.iOS.createPreviewContext({
contentHeight: 350,
preview: createPreview()
});
var table = Ti.UI.createTableView({
previewContext: context,
data: [{title: "Test 1", data: 1},{title: "Test 2", data: null}]
});
window.add(table);
window.open();
table.addEventListener("touchstart", function(e) {
Ti.API.warn("touchstart");
Ti.API.warn(e);
var row = e.source;
if(row.data == null) {
context.preview = null;
} else {
context.preview = createPreview();
}
});
context.addEventListener("peek", function(e) {
Ti.API.warn("peek");
Ti.API.warn(e);
});
context.addEventListener("pop", function(e) {
Ti.API.warn("pop");
Ti.API.warn(e);
});
function createPreview() {
return Ti.UI.createView({
backgroundColor: "#f00"
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment