PDA

View Full Version : Sorting Tree Grid that shows OBJECTS.



maps_tecnologia
6 Feb 2012, 12:52 PM
Hello.

I have a tree.Panel which store is populated by a dinamic json. Dinamic in the way that the data retrieved depends on user actions, so the columns my grid shows are dinamically configured.

Basically I get an Object containing all the fields I have to show, and for each column I have:


renderer: function(cell) {
return cell[Ext.Object.getKeys(value)[0]];
},
dataIndex: 'fullObject',

Which translates to something like:


renderer: function(cell) {
return fullObject.fieldName;
},
dataIndex: 'fullObject',


That works fine, but I can't order the columns.
I tought that maybe I had to provide the data types. which I did, but that doesnt seemed to work.

This is one of the columns configuration:



Object

dataIndex: "fullObject"
renderer: function (cell) {

arguments: null
caller: null
length: 1
name: ""
prototype: Object
__proto__: function Empty() {}

sortable: true
text: "Quantity"
type: "number"
__proto__: Object

mitchellsimoens
6 Feb 2012, 1:21 PM
So the value in the field fullObject in the record is an object? You will need to specify sortType ont he fullObject field in your model that will do the sorting.

maps_tecnologia
6 Feb 2012, 1:27 PM
Something like this:


fullObject: {a:1, b:2, c: yadda }

Then I go like:


column a | column b | column c
fullObject.a | fullObject.b | fullObject.c


Anyway, I am gonna look into that
sortType.

Thanks