Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Ext User
    Join Date
    Apr 2010
    Posts
    12
    Vote Rating
    0
    parit is on a distinguished road

      0  

    Default Sorting Scientific values and Decimals in a Grid column

    Sorting Scientific values and Decimals in a Grid column


    Hi,

    I have grid with a column that has decimal values like (1.6,2.3,0.2) as well as exponential values like (3e-70,4e-80) etc etc. When I try to sort the column then it just sorts the data in lexicographical manner i.e. 2 is put before 3e-70 while sorting in an ascending manner. I tried using a numberRenderer as:

    Code:
    NumberFormat format = NumberFormat.getScientificFormat();
    		final NumberCellRenderer<Grid<BeanModel>> cellRenderer = new NumberCellRenderer<Grid<BeanModel>>(format);
    		
    		GridCellRenderer<BeanModel> gridNumber = new GridCellRenderer<BeanModel>() {  
    		      public String render(BeanModel model, String property, ColumnData config, int rowIndex,  
    		          int colIndex, ListStore<BeanModel> store, Grid<BeanModel> grid) {  
    		        return cellRenderer.render(null, property, model.get(property));  
    		      }  
    		    };
    and then using this renderer in my column config as:

    Code:
    column = new ColumnConfig("minEVal","Min E-Val",75);
    column.setRenderer(gridNumber);
    columns.add(column);
    But it seems not to be working. Any ideas?

    - Parit
    Parit Bansal
    Masters Student (Computational Biology and Bioinformatics)
    ETH Zurich
    Switzerland

  2. #2
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    what type are your values? Do you have them as a string?

  3. #3
    Ext User
    Join Date
    Apr 2010
    Posts
    12
    Vote Rating
    0
    parit is on a distinguished road

      0  

    Default


    yes of course.. got it fixed thankx..

    - Parit
    Parit Bansal
    Masters Student (Computational Biology and Bioinformatics)
    ETH Zurich
    Switzerland

  4. #4
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    So please post your solution so others can use it too

  5. #5
    Ext User
    Join Date
    Apr 2010
    Posts
    12
    Vote Rating
    0
    parit is on a distinguished road

      0  

    Default


    As it turned out.. the fields of the model class that were rendered by the grid were strings instead of being double thats why when a sort is called on a column then the items in it were sorted lexicographical and not as numbers. So, I just changed the relevant fields from String to double. problem solved
    Parit Bansal
    Masters Student (Computational Biology and Bioinformatics)
    ETH Zurich
    Switzerland

Similar Threads

  1. Grid: Scientific notation in column
    By randomuser01 in forum Ext 2.x: Help & Discussion
    Replies: 5
    Last Post: 23 Dec 2008, 10:36 PM
  2. Grid fails with scientific notation
    By drujensen in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 12 Jun 2008, 4:39 PM
  3. Disable column onclick sorting, but still allow sorting via column menu
    By Troy Wolf in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 26 Mar 2008, 9:39 AM
  4. Grid Sorting does not properly orders the values.
    By Sandeep in forum Ext 1.x: Help & Discussion
    Replies: 3
    Last Post: 16 Sep 2007, 10:27 PM

Thread Participants: 1