Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ExtJS Costum存储表示_Extjs_Store - Fatal编程技术网

ExtJS Costum存储表示

ExtJS Costum存储表示,extjs,store,Extjs,Store,我想知道是否有任何ExtJS方法可以加载存储数据,加载数据后,我可以在主面板中创建其他组件(自定义面板),以我的特定方式显示数据 我希望使用自定义组件显示存储在面板中的数据您有两个选项: 如果您只需要显示数据,则为该任务量身定制 如果您确实需要一个组件(即,封装用户交互而不仅仅是显示的组件),那么您需要创建这个组件,并在存储加载时为每个记录创建一个组件,并将其添加到主面板中 要复制dataview的示例(选项1): Ext.define('Image'){ 扩展:“Ext.data.Model

我想知道是否有任何ExtJS方法可以加载存储数据,加载数据后,我可以在主面板中创建其他组件(自定义面板),以我的特定方式显示数据

我希望使用自定义组件显示存储在面板中的数据您有两个选项:

  • 如果您只需要显示数据,则为该任务量身定制
  • 如果您确实需要一个组件(即,封装用户交互而不仅仅是显示的组件),那么您需要创建这个组件,并在存储加载时为每个记录创建一个组件,并将其添加到主面板中
  • 要复制dataview的示例(选项1):

    Ext.define('Image'){
    扩展:“Ext.data.Model”,
    字段:[
    {名称:'src',类型:'string'},
    {名称:'caption',类型:'string'}
    ]
    });
    Ext.create('Ext.data.Store'{
    id:'imagesStore',
    模型:“图像”,
    数据:[
    {src:'http://www.sencha.com/img/20110215-feat-drawing.png,标题:'Drawing&Charts'},
    {src:'http://www.sencha.com/img/20110215-feat-data.png,标题:'Advanced Data'},
    {src:'http://www.sencha.com/img/20110215-feat-html5.png,标题:'彻底改变主题'},
    {src:'http://www.sencha.com/img/20110215-feat-perf.png,标题:'Performance Tuned'}
    ]
    });
    var imageTpl=new Ext.XTemplate(
    '',
    '',
    '',
    “
    {caption}”, '', '' ); Ext.create('Ext.view.view'{ 存储:Ext.data.StoreManager.lookup('imagesStore'), tpl:imageTpl, itemSelector:'div.thumb-wrap', emptyText:'没有可用的图像', renderTo:Ext.getBody() });
    你能分享一些如何做到这一点的信息吗?我已经为选项1提供了一些代码。您是否还需要选项2的示例?你真的需要一个组件吗?如果你附近有代码,你可以发布它,但如果没有,就不要麻烦了。我想XTemplate会适合我的
    Ext.define('Image', {
        extend: 'Ext.data.Model',
        fields: [
            { name:'src', type:'string' },
            { name:'caption', type:'string' }
        ]
    });
    
    Ext.create('Ext.data.Store', {
        id:'imagesStore',
        model: 'Image',
        data: [
            { src:'http://www.sencha.com/img/20110215-feat-drawing.png', caption:'Drawing & Charts' },
            { src:'http://www.sencha.com/img/20110215-feat-data.png', caption:'Advanced Data' },
            { src:'http://www.sencha.com/img/20110215-feat-html5.png', caption:'Overhauled Theme' },
            { src:'http://www.sencha.com/img/20110215-feat-perf.png', caption:'Performance Tuned' }
        ]
    });
    
    var imageTpl = new Ext.XTemplate(
        '<tpl for=".">',
            '<div style="margin-bottom: 10px;" class="thumb-wrap">',
              '<img src="{src}" />',
              '<br/><span>{caption}</span>',
            '</div>',
        '</tpl>'
    );
    
    Ext.create('Ext.view.View', {
        store: Ext.data.StoreManager.lookup('imagesStore'),
        tpl: imageTpl,
        itemSelector: 'div.thumb-wrap',
        emptyText: 'No images available',
        renderTo: Ext.getBody()
    });