View Full Version : sort an object based on field value

19 Dec 2011, 3:47 PM
Hi guys ,

I have a store which has a list of objects.


Ext.regModel("PF", {
{ name: 'ParkingFacilities', type: 'auto' },

{ name: 'ParkingZones', type: 'auto' },

{ name: 'Facilities', type: 'auto' },

{ name: 'ParkingSortFacilityID', type: 'auto' }




App.stores.ParkingFacility = new Ext.data.Store({
model: 'PF',
autoLoad: true,
listeners: {
dataChanged: function (store) {

If you see the image below, I am trying to sort all the object in the facility model by the field distance. But the item does not seem to be sorted.

JSON Returned:


Can some one show me a sample on how to sort the data. I am really stuck at this.

Any help would be greatly appreciated.

Thanks ,

20 Dec 2011, 4:15 AM
What is the type you have on the field Distance? You have it as a sting but it should be a float.

20 Dec 2011, 10:14 AM
I created another variable called DistanceForSort with a type Decimal. It Does not seems to work. Do i need to do any kind of a refresh of the dataStore once the change has been made.

When i ran it for the first time through the chrome console it worked but after then I have tried so many time i does not seem to work

Any suggestion.


20 Dec 2011, 11:05 AM
There is no type 'decimal'... it's float.

20 Dec 2011, 11:21 AM
From my backed (C#) it is returned as a decimal value through json. after that i am trying to sort it.

If i my json element has a values returned as 0.16 is it considered as float by sencha or any other type ? Please look at the image attached . It has a green box at the bottom marked with comment.


Pawan Venugopal