Appartamento in Affitto Milano – Washington

How to implement associations?

Added by Gabrio gabs 255 days ago

How do you implement an association column in the grid panel?

let's say I have an articles and an owners table.
article belongs_to :owner, and Owner has many :articles.

I can see from the http request, and logs that the assosiation is loaded, and a multidimensional array is returned.
But I cant seem to access the data correctly.
E.g. If I in the GridPanel columns declaration set dataIndex to 'owner[name]' nothing shows up.
If I set it to just 'owner' I get the text '[object Object]' in the grid.

?
--
columns: [
selections, {
id: 'name',
header: 'Name',
sortable: true,
width: 150,
renderer: Ext.util.Format.capitalize,
dataIndex: 'name'
},{
id: 'description',
header: 'Description',
sortable: true,
width: 300,
dataIndex: 'description'
},{
id: 'owner',
header: 'Eier',
sortable: true,
width: 150,
dataIndex: 'owner[name]' <----
}
],

----

Has anyone tried the grid out with associations?


Replies

RE: How to implement associations? - Added by Davide D'Agostino 240 days ago

Sorry Gabrio for my late response.

Can you put me the json data that your receive?

Thanks