Extjs4 每个函数都给了我一个错误
这是我的任务存储,当我尝试使用store.each获取它的记录时,它会给我TypeError:store.each不是一个函数Extjs4 每个函数都给了我一个错误,extjs4,Extjs4,这是我的任务存储,当我尝试使用store.each获取它的记录时,它会给我TypeError:store.each不是一个函数 store = Ext.create('Ext.data.TreeStore', { model: 'Task', folderSort: true, sortInfo: {
store = Ext.create('Ext.data.TreeStore', {
model: 'Task',
folderSort: true,
sortInfo: {
field: "StartDate",
direction: "ASC"
},
root:
{
text: '.',
expanded: true,
children: arrTasksData
}
});
我有一个按钮,点击它我需要访问存储记录。我使用下面的代码访问记录
console.log(store.getCount()); //Prints undefined
store.each(function (record,id) {
console.log(record.get("TaskName"));
});
上面的代码给出了console:TypeError:store中的错误。每个都不是函数
store = Ext.create('Ext.data.TreeStore', {
model: 'Task',
folderSort: true,
sortInfo: {
field: "StartDate",
direction: "ASC"
},
root:
{
text: '.',
expanded: true,
children: arrTasksData
}
});
虽然console.log(store)打印对象
但是console.log(store.getCount())打印未定义的数据。TreeStore对其数据使用嵌套结构。 当您查看Sencha()中的API文档时,没有可供您使用的getCount()方法。 对于处理框架,API文档是您最好的朋友强> 因此,您的store.getCount()无法工作。 为此,您需要编写自己的函数来计算叶节点数 我为此写了一篇简单的文章。 请注意,这还没有用各种数据进行全面测试。 这只是给你一些关于需要做什么的想法