Expand my Community achievements bar.

SOLVED

Custom widget grid panel problem.

Avatar

Level 3

Hi,

  I am trying to write a custom that contains a gridpanel. This gridpanel loads some static data. And this is the code I have.When I load it, nothing shows up.[img]2014-08-11_9-32-42.png[/img]

  Can anyone tell me what the problem is?

Thank you.

Ejst.ContactSearch = CQ.Ext .extend( CQ.form.CompositeField, { /** * xtype: hidden store real value file: this is json format * {url: '/content/sample', text: 'sample'} */ valueField : null , userPanel: null , constructor : function(config) { config = config || {}; var defaults = { border : true, layout : "form", autoWidth : false }; config = CQ.Util.applyDefaults(config, defaults); Ejst.ContactSearch.superclass.constructor.call( this, config); } /** * create composite fields */ , initComponent : function() { Ejst.ContactSearch.superclass.initComponent.call(this);
// create children items this.valueField = new CQ.Ext.form.Hidden({ name : this.name }); var myData = [ ['user1','user1@gmail.com','office1','state1'], ['user2','user2@gmail.com','office2','state2'] ]; //The Data model that is used to populate the grid. It uses myData as the data source var store = new CQ.Ext.data.Store({ proxy: new CQ.Ext.data.MemoryProxy(myData), reader: new CQ.Ext.data.ArrayReader({}, [ {name: 'name'}, {name: 'email'}, {name: 'office'}, {name: 'state'} ]) }); this.userPanel = new CQ.Ext.grid.GridPanel({ store: store, colModel: new CQ.Ext.grid.ColumnModel({ defaults: { width: 120, sortable: true }, columns: [ {id: 'name', header: 'Name', width: 200, sortable: true, dataIndex: 'name'}, {header: 'Email', sortable: true, dataIndex: 'email'}, {header: 'Office', sortable: true, dataIndex: 'office'}, {header: 'State', sortable: true, dataIndex: 'state'} ] }), viewConfig: { forceFit: true, }, sm: new CQ.Ext.grid.RowSelectionModel({singleSelect:true}), width: 600, height: 300, frame: true, title: 'User information', iconCls: 'icon-grid' }); this.add(this.userPanel); } }); CQ.Ext.reg("contactSearch", Ejst.ContactSearch);
1 Accepted Solution

Avatar

Correct answer by
Employee

Can you try changing your myData variable and add the key names? Something like 

name:user1, email:user1@user1.com, office:office1, state:state1.

View solution in original post

1 Reply

Avatar

Correct answer by
Employee

Can you try changing your myData variable and add the key names? Something like 

name:user1, email:user1@user1.com, office:office1, state:state1.