1. #1
    Ext User
    Join Date
    Jul 2008
    Posts
    2
    Vote Rating
    0
    ryan0902 is on a distinguished road

      0  

    Smile remoteSort with special characters

    RemoteSort is working well but special characters with paging grid.
    Here is testing code and screenshot.
    Any advise is welcome. Thanks.

    Code:
    Ext.onReady(function(){
        var store = new Ext.data.Store({        
            
            remoteSort : true,
            reader: new Ext.data.XmlReader({
                record: 'Item'
            }, [{
                name: 'Author',
                mapping: 'Author'
            },{
                name : 'Title',
                type: 'string',
                mapping : 'Title'
            }])
        });
    
        var pagingBar = new Ext.PagingToolbar({
            pageSize: 7,
            store: store,
            displayInfo: true,
            displayMsg: 'Displaying setups {0} - {1} of {2}',
            emptyMsg: "No setups to display"
        });
    
        var grid = new Ext.grid.GridPanel({
            store: store,
            columns: [{
                header: "Author",
                width: 150,
                dataIndex: 'Author',
                sortable: true
            },{
                header: "Title",
                width: 180,
                dataIndex: 'Title',
                sortable: true
            }],
            bbar: pagingBar,
            renderTo:'example-grid',
            width:355,
            height:200
        });
    
        Ext.Ajax.request({
            url: 'sheldon.xml',
            method: 'GET',
            success : function( r ){
                store.proxy = new Ext.data.PagingMemoryProxy(r.responseXML);
                store.load({
                    params:{
                        start: 0,
                        limit: pagingBar.pageSize
                    }
                });
            }
        });
    });
    Attached Images
    Attached Files

  2. #2
    Ext User
    Join Date
    Jul 2008
    Posts
    2
    Vote Rating
    0
    ryan0902 is on a distinguished road

      0  

    Talking overriding special characters sorting in PagingMemoryProxy.js

    It seems to work after overriding special characters sorting in PagingMemoryProxy.js
    Code:
    var Str1 = a.data[params.sort];
    var Str2 = b.data[params.sort];
    if (Str1.match(/[a-z,A-Z]/) || Str2.match(/[a-z,A-Z]/))
    {
        v = fn(Str1.toLowerCase(), Str2.toLowerCase()) * -1;
    }
    // Special characters
    else if(Str1.match(/[^a-zA-Z0-9]/) || Str2.match(/[^a-zA-Z0-9]/))
    {
        v = fn(Str1, Str2) * -1;
    }
    else
    {
        var aI = parseFloat(Str1);
        var bI = parseFloat(Str2);
        v = fn(aI, bI) * -1;
    }