在sencha中处理叶节点
问题描述:
我使用sencha创建了一个嵌套列表。 现在点击我得到一个列表,直到我到达叶节点。在sencha中处理叶节点
现在我想要的是,点击一个叶节点,我想生成一个事件,使我能够打开一个文件。
不知道该怎么做。
我嵌套列表代码是提前
Ext.define("InfoImage.view.nestedList", {
extend:'Ext.NestedList',
xtype:'nestedList',
id:'nestedList',
config:{
fullscreen:'true',
title:'Nested List',
xtype:'nestedList',
displayField : 'text',
html:'Nested List on its way!!!',
store:'nestedListStore'
//itemTpl:'{text}'
}
});
感谢。
答
我找到了使用嵌套列表提供的事件“onleafitemtap”的解决方案。
答
我想,你的需要PhoneGap在这里。
文件系统访问不适用于Sencha Touch。因此,您需要使用phonegap的File API来访问和读取存储在系统中的文件。
FILE API : An API to read, write and navigate file system hierarchies.
样品从PhoneGap的e.g,
...
...
// PhoneGap is ready
function onDeviceReady() {
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
}
function gotFS(fileSystem) {
fileSystem.root.getFile("readme.txt", {create: true}, gotFileEntry, fail);
}
function gotFileEntry(fileEntry) {
fileEntry.file(gotFile, fail);
}
function gotFile(file){
readDataUrl(file);
readAsText(file);
}
function readDataUrl(file) {
var reader = new FileReader();
reader.onloadend = function(evt) {
console.log("Read as data URL");
console.log(evt.target.result);
};
reader.readAsDataURL(file);
}
function readAsText(file) {
var reader = new FileReader();
reader.onloadend = function(evt) {
console.log("Read as text");
console.log(evt.target.result);
};
reader.readAsText(file);
}
...
...
希望帮助你!
打开文件?哪个档案?它在哪里? – 2012-04-27 11:41:25
位于系统上的任何文件。 – Khush 2012-04-27 11:42:32
位于系统上的文件?我不认为,像SenchaTouch这样的本地功能就像文件访问一样。 Sencha Touch是用于UI的,而不是本地功能。 – 2012-04-27 11:43:55