简体   繁体   English

显示来自Sencha Touch中存储数据的复选框字段列表

[英]Displaying list of checkboxfield from store data in Sencha Touch

I am new to Sencha Touch. 我是Sencha Touch的新手。 I am trying to build a simple ToDo app. 我正在尝试构建一个简单的ToDo应用。 So far I have tried displaying a list of tasks data from store using Ext.dataview.List and its itemTpl 到目前为止,我尝试使用Ext.dataview.List及其itemTpl显示来自商店的任务数据列表

Ext.define('ToDoListApp.view.TaskList', {
    extend: 'Ext.dataview.List',
    requires: [ 'ToDoListApp.store.TaskStore' ],

    config: {
        displayField: 'title',
        id: 'taskList',
        itemTpl: '<div class="task completed_{done}">{title}</div>',
        store: Ext.create('ToDoListApp.store.TaskStore'),
    }
});

However, what I'm really trying to achieve is to display a list of checkbox fields based on the data from store. 但是,我真正想要实现的是基于商店中的数据显示复选框字段的列表。 I'm looking for a config that uses the object below instead of itemTpl : 我正在寻找使用下面的对象而不是itemTpl的配置

{
    xtype: 'checkboxfield',
    checked: true, /* should be based on the "done" value */
    label: 'Test', /* should be based on the "title" value */
}

Is this possible? 这可能吗? If not, what would be a good way to achieve similar results? 如果没有,那么获得类似结果的好方法是什么?

Best Regards, 最好的祝福,

Erwin 欧文

What you are looking for is to create a custom dataItem by extending it. 您正在寻找的是通过扩展它来创建自定义dataItem

You can find and example at: 您可以在以下位置找到示例:

http://www.sencha.com/blog/dive-into-dataview-with-sencha-touch-2-beta-2/ http://www.sencha.com/blog/dive-into-dataview-with-sencha-touch-2-beta-2/

Hope it helps- 希望能帮助到你-

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM