Wednesday 15 June 2011

javascript - how to add custom sorting to ext grid -


Let's say that I have a data set:

  [{ID: 1, Name: "C"}, {ID: 2, Name: "A"}, {ID: 3, Name: "D"}]   

When I column for the same grid To do this I create:

  this.column = {id: {hidden: true}, name: {text: 'name', editor: {xtype: "textfield"}} };   

When I sort the 'Name' column, I should describe it with 'id' and not alphabetically.

So rather than sorting like this: A, C, D want to be it: C, A, D

I have tried to use DataInDX: On the Name column 'ID' and then mapping the ID to the correct name to display the purposes, interrupts my editing functionality.

Is there an easy way to sort the columns in the id (I'm using Ex 4.2)?

Just configure the store option:

  store: { ... sorters: [{property: 'id', direction: 'asc'}]}   

or method ...

No comments:

Post a Comment