EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: Ellipsis on July 09, 2012, 04:04:44 AM



Title: Datagrid sorting
Post by: Ellipsis on July 09, 2012, 04:04:44 AM
When using a remote json source and enabling the sorting on certain columns, the sort event seems to reload the external json data, this is an unwanted action.

The columns don't get sorted when clicked, what can be the cause?

Code:
jQuery('#studentNr').combogrid({
        mode: 'remote',
        width: 200,
        panelWidth: 400,
        fitColumns: true,
        idField: 'key',
        textField: 'emplid',
        striped: 'true',
        loadMsg: 'Gegevens worden opgehaald, een ogenblik ....',
        rownumbers: 'true',
        singleSelect: 'true',
        columns: [[
            {field:'surname',title:'Achternaam',width:180,sortable:true},
            {field:'initials',title:'Initialen',width:40},
            {field:'emplid',title:'Studentnr.',width:80,sortable:true}
        ]],
        onSelect: function(rowIndex,rowData){
        // Populate the input fields from the returned values
        },
        onBeforeLoad: function(param){
            if (!param.q || param.q.length<5) return false;
        },
        loader: function(param,success,error){
            jQuery.ajax({
url: 'GMActionController.do?myaction=getPersonsByAjax&principalDisplayMode=principalIsisCode',
cache: false,
dataType: 'json',
data: {
personIdOrSurname: param.q,
roleType: 'student'
},
                success: function(data){
                    success(data.personRecordSet);
                },
                error: function(jqXHR, textStatus, errorThrown) {
console.log(errorThrown); console.log(textStatus);
}
            });
        }
    });