سؤال

I has a question for Sencha Touch2? why the dataView don't display?Thanks a lot

This is the model file,app/model/Worklist.js

Ext.define('Geo.model.Worklist', {
    extend: 'Ext.data.Model',

    config: {
        fields: [
            {name: 'name', type: 'string'},
            {name: 'url',   type: 'string'}
        ]
    }
});

this is the store file, app/store/Worklist.js /** * this is the store file, * app/store/Worklist.js */

Ext.define('Geo.store.Worklist',{
    extend: 'Ext.data.Store',
    config: {
        model: 'Geo.model.Worklist',
        autoLoad: true,
        data:[
            {name:'book1',url:'images/html51.jpg'},
            {name:'book2',url:'images/html52.jpg'},
            {name:'book3',url:'images/html53.jpg'},
            {name:'book4',url:'images/html54.jpg'},
            {name:'book5',url:'images/html55.jpg'}
        ]
    }
});

this is the view file, app/view/dashboard/Show.js /** * this is the view file, * app/view/dashboard/Show.js */

Ext.define('Geo.view.dashboard.Show', {
    extend: 'Ext.DataView',
    xtype: 'dashboard-show',

    //fullscreen: true,
    scrollable: 'vertical',
    store: 'Worklist',
    itemTpl: new Ext.XTemplate(
        '<tpl for=".">',
            '<div style="font-size:12px;">',
            '<img src="{url}" titel="{name}"><br />',
            '{name}',
            '</div>',
        '</tpl>'
    )
});

/** * Main Controller file,Application.js */

config: {
    refs: {
        main: 'mainview',
        editButton: '#editButton',
        dashboards: 'dashboards',
        showDashboard: 'dashboard-show',
        editDashboard: 'dashboard-edit',
        saveButton: '#saveButton'
    }
}
var workStore = Ext.create('Geo.store.Worklist');
this.showDashboard = Ext.create('Geo.view.dashboard.Show');
this.showDashboard.setStore(workStore);
this.getMain().push(this.showDashboard);

I don't know why it can't display when i tap one of list item,anybody can help me?thanks a lot

هل كانت مفيدة؟

المحلول

I find the problem,i forget the config property in Geo.view.dashboard.Show

it should be like this

 config:{
    fullscreen: true,
    scrollable: 'vertical',
    store: 'Worklist',
    itemTpl: new Ext.XTemplate(
        '<tpl for=".">',
            '<div style="font-size:12px;">',
            '<img src="{url}" titel="{name}"><br />',
            '</div>',
        '</tpl>'
    )
}

thanks a lot

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top