读取txt文件中的数据到extjs中的grid面板?

如何将txt文件中的数据读取到extjs中的grid面板中?

没有demo。大概就是下面的思路,也就是在read函数里对文本内容解析。

Ext.ux.TextJsonReader = Ext.extend(Ext.data.JsonReader,{
read : function(response){ //该函数用来解析数据
var json = response.responseText; //获取 text文本值
//根据 你的text格式解析成json 数组就行了。o代表json数组

     return this.readRecords(o); 
}

})

//store 使用扩展的文本解析器
new Ext.data.JsonSotre({
reader:Ext.ux.TextJsonReader({}) //使用扩展的 文本解析器 即可。
})

继承 Ext.data.JsonReader 对象 重写read 函数,吧txt文本值解析成json对象即可。
read : function(response){
var json = response.responseText;
var o = eval("("+json+")");
if(!o) {
throw {message: "JsonReader.read: Json object not found"};
}
return this.readRecords(o);
},