在ExtJS中禁用属性网格上的自动排序

Fat*_*cet 5 propertygrid extjs

我正在处理财产网格.我想阻止属性网格的列名称的自动排序.这是我的代码.大胆突出显示的代码是我的属性网格源,它的顺序就像我想看到的那样.但Ext是按字母顺序自动排序列顺序.我怎么能防止这种情况.

谢谢你的任何建议.

Ext.ns('Application.propertygrid');
Application.propertygrid.FileDetail = Ext.extend(Ext.grid.PropertyGrid, {
    title: 'File Detail',
    height: 200,
    border: false,
    stripeRows: true,
    flex: 1,
    initComponent: function () {
        Application.propertygrid.FileDetail.superclass.initComponent.apply(this, arguments);
    },
    source: {
        Name: 'Please select a file',
        Type: 'Please select a file',
        Size: 'Please select a file',
        Path: 'Please select a file',
        FullPath: 'Please select a file',
        Width: 'Please select a file',
        Height: 'Please select a file'
    },
    listeners: {
        beforeedit: function(){
            return false; // prevent editing 
        },
        headerclick: function(){
            return false; // prevent column sorting on click
        }
    }
})
Ext.reg('filedetail', Application.propertygrid.FileDetail);

Fat*_*cet 8

是啊.我已经完成了它.这是解决方案.

var p = new Ext.grid.PropertyGrid({
  ...
  // do not specify 'source' here
});

delete p.getStore().sortInfo; // Remove default sorting
p.getColumnModel().getColumnById('name').sortable = false; // set sorting of first column to false
p.setSource(source); // Now load data


Tom*_*itu 7

这对Extjs 4不起作用:

delete p.getStore().sortInfo; // Remove default sorting
p.getColumnModel().getColumnById('name').sortable = false; // set sorting of first column to false
p.setSource(source); // Now load data
Run Code Online (Sandbox Code Playgroud)

你可以试试这个:

p.getStore().sorters.items = [] // which should remove sorting information from the store
p.setSource(source) // now load the data
Run Code Online (Sandbox Code Playgroud)