Results 1 to 2 of 2

Thread: Default Sort is not Working in ext3.x

  1. #1
    Sencha User
    Join Date
    Dec 2010
    Posts
    11

    Default Default Sort is not Working in ext3.x

    Hello,

    DefaultSort is not working below is the snipp, please advise.

    <html>

    <script type="text/javascript" src="../lib/ext-base.js"></script>
    <script type="text/javascript" src="../lib/ext-all.js"></script>
    <link rel="stylesheet" type="text/css" href="../css/ext-all.css" />


    <script language="javascript">

    Ext.onReady(function()
    {
    Ext.QuickTips.init();
    Ext.data.Types.FLOATORSTRING = {
    convert: function(v, n) {
    return n;
    },
    sortType: function(v) {
    v = Ext.isNumber(v) ? v : parseFloat(String(v), 10);
    return isNaN(v) ? -999999 : v;
    },
    type: 'floatOrString'
    };

    var myGridPanel = new Ext.grid.GridPanel({
    id: 'testGridForSort',
    title: 'Assoc Docs',
    //applyTo: 'myDiv',
    width: 200,
    height: 200,
    viewConfig :{
    forceFit:false,
    emptyText:'No rows to display' //Check for no rows
    },
    store: new Ext.data.ArrayStore({
    fields: [{name: 'field1', type: 'floatOrString',mapping: 'field1'}],
    data:['-1','-','100','2','124','-','70','145','zzbcd','pqr','azz']
    //sortInfo: { field: "field1", direction: "ASC" }
    }),
    columns: [{header: 'Sort me', dataIndex: 'field1', sortable: true}],
    buttons: [{
    text: 'Search',handler : function(){}
    }, {
    text: 'Clear',handler : function(){}
    }]
    });

    myGridPanel.getStore().setDefaultSort('field1', 'asc');
    myGridPanel.render('myDiv');
    });


    </script>
    <div id="myDiv" style="position:absolute; top:150; left:40%;">
    </div>
    </html>

    Thanks,
    Amit

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,379

    Default

    It looks like it's sorting to me. What's wrong?
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •