Created
December 20, 2015 22:49
-
-
Save hansemannn/9c05d720e9f5af0f958d to your computer and use it in GitHub Desktop.
Ti.UI.iOS.PreviewContext with depending data
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
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