2

I have a store connected to a model. One propertie of the model instance is an Array. I have set the type propertie to 'auto'. I have connected this store to a grid and this is where I have encountered trouble. How should I change the settings to display all the array instances inside the grid. Is this possible? Now I only see [object:Object]. Please see screenshot:

enter image description here

Talha Masood
  • 993
  • 1
  • 7
  • 22
Jacob
  • 3,580
  • 22
  • 82
  • 146

2 Answers2

2

You can define your own renderer in grid columns configuration for colums in which you want to display array values.

For example, this renderer display all items from array separated with comma:

columns: [
    {
        ...
        renderer: function(value){
           return value.join(', ');
        }
        ...
    }
]
Akatum
  • 3,976
  • 2
  • 18
  • 25
2

Just add a renderer field to the column with a .toString() method on the value. For example:

Ext.create('Ext.grid.Panel', {
    ...
    columns: [
        {
            text: 'Title',  
            dataIndex: 'somearrayrecord'
            renderer: function(value) {
               return value.toString();
            }
        },
    ],
    ...
});

This will use javascript's array.toString() method, which will print out the values in your array.

Kyle Fransham
  • 1,859
  • 1
  • 19
  • 22