我正在使用dojo.data。 ItemFileWriteStore作为网格的存储。 当我尝试使用store.newItem()方法将数据添加到存储时, 我收到以下错误。
" Error: assertion failed in ItemFileWriteStore ".
can any one help me why i am getting this error?
请找到代码段:
var tabledata={identifier:"TimeStamp",items:[]};
var store=new dojo.data.ItemFileWriteStore({data:tabledata});
var data=xhrpost();
//data contains
// {"TimeStamp":"2011/12/07 04:37:29 ","UserName":" root ","Command":" ppm restart"}| //{"TimeStamp":"2011/12/07 05:02:14 ","UserName":" root ","Command":" ppm restart"}|
//{"TimeStamp":"2011/12/07 05:33:01 ","UserName":" root ","Command":" ppm restart"}|
//{"TimeStamp":"2011/12/07 06:18:17 ","UserName":" root ","Command":" ppm restart"}
var arrdata=data.spilt("|");
for(var i=0;i<arrdata.length;i++)
{
//i am getting ajax response as text so i am converting to json
var row=dojo.fromJson(data[i]);
store.newItem(row);
}
的问候, Kamesh