ExtJs 3.4.0 Grid Multiselect

Posted By Vitaliy | February 26, 2013 | ExtJS 3.4.0
2 4272
ExtJs 3 Grid has multiselect feature by default.

Js Code

new Ext.grid.GridPanel({
    title: 'Users',
    store: new Ext.data.JsonStore({
        fields: ['id', 'name'],
        data: [
            { 'id': 1, 'name': 'user-1' },
            { 'id': 2, 'name': 'user-2' },
            { 'id': 3, 'name': 'user-3' },
            { 'id': 4, 'name': 'user-4' }
        ]
    }),
    columns: [
        { header: 'id', dataIndex: 'id' },
        { header: 'name', dataIndex: 'name' }
    ],
    width: 300,
    height: 150,
    renderTo: Ext.getBody()
});
            

ExtJs 4.1: Read complex json with hasOne association

Posted By Vitaliy | September 15, 2012 | ExtJS 4.1.0
0 5073
Ext.data.association.HasOne - represents a one to one association with another model.
The owner model is expected to have a foreign key which references the primary key of the associated model

Js Code

Ext.define('User', {
    extend: 'Ext.data.Model',
    fields: ['id', 'name'],
    associations: [{ type: 'hasOne', model: 'Status', associationKey: 'status'}]
});

Ext.define('Status', {
    extend: 'Ext.data.Model',
    fields: [
        { name: 'id', type: 'int' },
        { name: 'title', type: 'string', mapping: 'st_title' }
    ]
});