PDA

View Full Version : Sorting numbers not working



mdarretta
15 Mar 2016, 6:11 PM
i'm trying to sort numbers in my grid.
numbers are sorting like this:
7002483209
8623792958
90759049
number beginning with 9 should be first.
I've tried the different types and sort types on columns.
i read i should set type in my json reader.
can someone send me an example of this using my store below.

here is my store:

staffStore = Ext.create('Ext.data.Store', {
model: 'staffRecords',
autoLoad:{start:0, limit:25},
pageSize:25,
remoteSort: true,
simpleSortMode : true,
sorters:[{property:'fullName',direction:'asc'}],
baseParams: {
processorName: 'StaffProcessor',
processorAction: 'paginateStaffList',
ajaxAction: 'true'
},
proxy: {
type: 'ajax',
url: staffURL,
method: 'POST',
directionParam : 'sort.direction',
sortproperty : 'sort.property',
reader: {
type: 'json',
rootProperty: 'ListInfo',
totalProperty: 'total'
},
extraParams:{
processorName: 'StaffProcessor',
processorAction: 'paginateStaffList',
ajaxAction: 'true'
},
}

Gary Schlosberg
15 Mar 2016, 10:25 PM
In your 'staffRecords' model (http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.data.Model), is your field type 'int'?

mdarretta
16 Mar 2016, 5:36 AM
I tried Int and Float types.
I'm using remote sort and oracle db is using Long and sending json.
Field is not filled with leading zeros.

mdarretta
16 Mar 2016, 8:37 AM
i tried dif. Xtypes. i think i need to add type to json reader. does that make sense?

Gary Schlosberg
16 Mar 2016, 3:47 PM
What does your JSON data look like?

mdarretta
16 Mar 2016, 4:53 PM
I have it working. I added oracle function to_number in my select order by in Backed java class. Thank you for your response.