1. #1
    Sencha User
    Join Date
    Apr 2011
    Posts
    123
    Vote Rating
    2
    denisputnam is on a distinguished road

      0  

    Default Data grid data issue

    Data grid data issue


    I am having problems getting the data in data/users.json to display for the MVC example when I try to reproduce the example in Architect. Can someone tell me what I am doing wrong?

    I can't tell if my problem is in the view, model, or the controller.

    Below is the source and I have attached the project file as a zip.

    -Denis
    Ext.Loader.setConfig({
    enabled: true
    });


    Ext.application({
    models: [
    'User'
    ],
    stores: [
    'Users'
    ],
    autoCreateViewport: true,
    name: 'AM',
    controllers: [
    'Users'
    ],


    launch: function() {
    Ext.create( 'Ext.container.Viewport', {
    layout: 'fit',
    items: {
    xtype: 'userlist'
    }
    });
    }


    });
    Ext.define('AM.controller.Users', {
    extend: 'Ext.app.Controller',


    models: [
    'User'
    ],
    stores: [
    'Users'
    ],
    views: [
    'user.List'
    ],


    init: function(application) {
    this.control({
    'viewport > userlist': {
    itemdblclick: this.editUser
    }
    });
    },


    editUser: function() {
    console.log('Double clicked on ' + record.get( 'name' ) );
    }


    });
    Ext.define('AM.view.user.List', {
    extend: 'Ext.grid.Panel',
    alias: 'widget.userlist',


    height: 250,
    width: 400,
    autoScroll: true,
    title: 'All Users',
    store: 'Users',


    initComponent: function() {
    var me = this;


    Ext.applyIf(me, {
    viewConfig: {


    },
    columns: [
    {
    xtype: 'gridcolumn',
    dataIndex: 'name',
    flex: 1,
    text: 'Name'
    },
    {
    xtype: 'gridcolumn',
    dataIndex: 'email',
    flex: 1,
    text: 'Email'
    }
    ]
    });


    me.callParent(arguments);
    }


    });
    Ext.define('AM.store.Users', {
    extend: 'Ext.data.Store',
    requires: [
    'AM.model.User'
    ],


    constructor: function(cfg) {
    var me = this;
    cfg = cfg || {};
    me.callParent([Ext.apply({
    autoLoad: true,
    storeId: 'UsersStore',
    model: 'AM.model.User'
    }, cfg)]);
    }
    });
    Ext.define('AM.model.User', {
    extend: 'Ext.data.Model',


    proxy: {
    type: 'ajax',
    url: 'data/users.json',
    reader: {
    type: 'json',
    root: 'users'
    }
    }
    });


    data/users.json
    {
    success: true,
    users: [
    { id: 1, name: 'Ed', email: 'ed@sencha.com' },
    { id: 2, name: 'Tommy', email: 'tommy@sencha.com' }
    ]
    }
    Attached Files

  2. #2
    Sencha User
    Join Date
    Jun 2011
    Posts
    350
    Vote Rating
    1
    bharatn is on a distinguished road

      0  

    Default


    You are missing fields on the Model. Also url prefix was not set correctly.
    Attached Files
    Bharat Nagwani
    Sencha Designer Development Team

  3. #3
    Sencha User
    Join Date
    Apr 2011
    Posts
    123
    Vote Rating
    2
    denisputnam is on a distinguished road

      0  

    Default Thank you so much

    Thank you so much


    bharatn, you are the man! Thank you.

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar