Sencha touch Sencha Touch无法调用方法';substr';出游人数:10人

Sencha touch Sencha Touch无法调用方法';substr';出游人数:10人,sencha-touch,touch,substring,substr,Sencha Touch,Touch,Substring,Substr,嗨,正如标题所说,我突然出现了这个错误,没有任何改变。 这是文件位置代码: Ext.define('Wickelplaetze.store.Locations', { extend: 'Ext.data.Store', requires: 'Wickelplaetze.model.Location', config: { model: 'Wickelplaetze.model.Location', storeId: 'locationsstore', grouper:

嗨,正如标题所说,我突然出现了这个错误,没有任何改变。 这是文件位置代码:

Ext.define('Wickelplaetze.store.Locations', {
extend: 'Ext.data.Store',
requires: 'Wickelplaetze.model.Location',

config: {
    model: 'Wickelplaetze.model.Location',
    storeId: 'locationsstore',
    grouper: {
        groupFn: function(record) {
            return record.get('ort').substr(0, 1);
        },
        sortProperty: 'ort'
    },
    proxy: {
        type: 'ajax',
        url: 'http://freakp.com/wpapp/form-data.json',
        withCredentials: false,
        useDefaultXhrHeader: false
    },
    autoLoad: true
}   

}))

对于键
ort
,json中有
null
值。您可以检查
ort
是否不为空,然后
返回
like-

 if(record.get("ort")!= null){
     return record.get('ort')[0];
 }
这样做将删除该错误。但这并不能正确地对记录进行排序

还有一件事,如果您想按
ort
的第一个字母对列表进行排序,您可以直接使用-

返回记录。获取(“ort”)[0]

当我尝试用您的代码填充列表时,它实际上无限运行。我什么也没得到。对这些值进行排序非常慢。填充列表花了3分钟

更新


以你为例。您可以在列表底部看到空值。键
ort

@FredRickAkpotosu-Nartey有7个空值(很高兴我能帮助你。)