Đại diện cửa hàng ExtJS Costum (ExtJS Costum store representation)


問題描述

Đại diện cửa hàng ExtJS Costum (ExtJS Costum store representation)

I wander if there is any ExtJS way that I can load store with data and after it is loaded I can create in master panel other my components (custom panel) to show that data in my specific way?

I want display data from store in panel with my custom components


參考解法

方法 1:

You have two options:

  1. If you only need to display the data then DataView is tailored for this task.
  2. If your really need a component (ie, something that encapsulates user interaction and not just display), then you need to create this component and as your store loads create a component per record and add it to your master panel.

To copy the docs example of dataview (option 1):

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()
});

(by gedOIzhaki)

參考文件

  1. ExtJS Costum store representation (CC BY‑SA 3.0/4.0)

#store #extjs






相關問題

Sencha touch 2:通過代理在商店檢索信息 (Sencha touch 2: retrieve infos by proxy in store)

Đại diện cửa hàng ExtJS Costum (ExtJS Costum store representation)

Cửa hàng Sencha Touch 2 đạt kỷ lục (Sencha Touch 2 store get record)

更換和存放 (Replacing and Storing)

如何重命名Window Store App的.exe(可執行文件)文件? (How to rename .exe (executable) file of Window Store App?)

Socket.io 和 Extjs:為 Store 檢索數據 (Socket.io and Extjs: Retrieving data for Store)

獲取組件中的輸入值反應本機 (Get a value of input in a component react native)

為小組存儲生產密碼的最佳實踐 (Best practices for storing production passwords for small groups)

有人可以解釋一下 iphone 證書的東西,步驟是什麼樣的嗎? (Can someone explain me the iphone certificate stuff, how the steps look like?)

用戶退出應用程序時在 MapKit 中存儲註釋 (Store annotations in MapKit when user quit application)

使用 Injector angular 7 將 Store 注入子類 (Injecting Store to sub classes using Injector angular 7)

通過 VBA 中的輸入創建數組 (Creath an array by input in VBA)







留言討論