Sencha触摸嵌套列表无数据

编程入门 行业动态 更新时间:2024-10-28 15:19:06
本文介绍了Sencha触摸嵌套列表无数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我是sencha touch的新手.我用的是mvc方法.请在下面查看我的代码

I am new for sencha touch. I using mvc method. Please see my code below

Main.js

Ext.define('test.view.Main', { extend: 'Ext.tab.Panel', xtype: 'main', requires: [ 'Ext.TitleBar', 'Ext.Video', 'Ext.dataview.NestedList' ], config: { tabBarPosition: 'bottom', items: [ { title: 'Welcome', iconCls: 'home', styleHtmlContent: true, scrollable: true, items: { docked: 'top', xtype: 'titlebar', title: 'Welcome to Sencha Touch 2' }, html: [ "You've just generated a new Sencha Touch 2 project. What you're looking at right now is the ", "contents of <a target='_blank' href=\"app/view/Main.js\">app/view/Main.js</a> - edit that file ", "and refresh to change what's rendered here." ].join("") }, { title: 'Get Started', iconCls: 'action', items: [ { docked: 'top', xtype: 'titlebar', title: 'Getting Started' }, { xtype: 'nestedlist', } ] } ] } });

Nestedlist.js

Nestedlist.js

Ext.define('bluebutton.view.NestedList', { extend: 'Ext.NestedList', xtype: 'nestedlist', requires: [ 'Ext.field.Select', 'Ext.field.Search', 'Ext.plugin.ListPaging', 'Ext.plugin.PullRefresh', ], config: { store : { xclass : 'Test.store.data'}, detailContainer: detailContainer, detailCard: true, }, });

Test.store.data

Test.store.data

Ext.define('Test.store.data', { extend: 'Ext.data.TreeStore', config: { model: 'Test.model.data', defaultRootProperty: 'items', root: { items: [ { text: 'Drinks', items: [ { text: 'Water', items: [ { text: 'Still', leaf: true }, { text: 'Sparkling', leaf: true } ] }, { text: 'Soda', leaf: true } ] }, { text: 'Snacks', items: [ { text: 'Nuts', leaf: true }, { text: 'Pretzels', leaf: true }, { text: 'Wasabi Peas', leaf: true } ] } ] } } });

model.js

Ext.define('Test.model.data', { extend: 'Ext.data.Model', config: { fields: ['text'] } });

但是嵌套列表无法获取数据.我得到空名单.有什么办法吗?

But nested list no able to get the data. I get empty list. Any solution?

推荐答案

如果要在存储区中提供内联数据,应该不是data属性而不是root?

If you are providing inline data in store shouldn't it be data attribute instead of root?

Ext.define('Test.store.data', { extend: 'Ext.data.TreeStore', config: { model: 'Test.model.data', defaultRootProperty: 'items', data: { items: [ { text: 'Drinks', items: [ { text: 'Water', items: [ { text: 'Still', leaf: true }, { text: 'Sparkling', leaf: true } ] }, { text: 'Soda', leaf: true } ] }, { text: 'Snacks', items: [ { text: 'Nuts', leaf: true }, { text: 'Pretzels', leaf: true }, { text: 'Wasabi Peas', leaf: true } ] } ] } } });

更多推荐

Sencha触摸嵌套列表无数据

本文发布于:2023-10-24 02:47:51,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1522719.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:嵌套   无数据   列表   Sencha

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!