IE報錯:You're trying to decode and invalid JSON String: {"ganttTask":{"baseline_end_date":null,"baseline_start_date":null,"duration":0.0,"duration_unit":null,"end_date":null,"id":4,"index":3,"name":"New Task","other_field":null,"parent_id":null,"percent_done":100,"pid":7,"priority":null,"start_date":null,"task_id":"JMPAR000007"},"ganttTaskList":[{"baseline_end_date":null,"baseline_start_date":null,"duration":0.0,"duration_unit":null,"end_date":"2015-07-23","id":1,"index":1,"name":"New Task","other_field":","parent_id":null,"percent_done":100,"pid":7,"priority":null,"start_date":"2015-07-02","task_id":"JMPAR000007"},{"baseline_end_date":null,"baseline_start_date":null,"duration":0.0,"duration_unit":null,"end_date":null,"id":2,"index":4,"name":"New Task","other_field":null,"parent_id":null,"percent_done":0,"pid":7,"priority":null,"start_date":null,"task_id":"JMPAR000007"},{"baseline_end_date":null,"baseline_start_date":null,"duration":0.0,"duration_unit":null,"end_date":"2015-07-29","id":3,"index":2,"name":"New Task","other_field":null,"parent_id":null,"percent_done":0,"pid":7,"priority":null,"start_date":"2015-07-01","task_id":"JMPAR000007"},{"baseline_end_date":null,"baseline_start_date":null,"duration":0.0,"duration_unit":null,"end_date":null,"id":4,"index":3,"name":"New Task","other_field":null,"parent_id":null,"percent_done":100,"pid":7,"priority":null,"start_date":null,"task_id":"JMPAR000007"}],"signTask":null,"success":true,"taskCount":0,"taskList":null,"task_id":"JMPAR000007"}
如果date裡有日期它就不報錯。為什麼?
Ext.define('GanttTask', {
extend: 'Ext.data.Model',
fields: [
{name: 'task_id', type: 'string'},
{name: 'name', type: 'string'},
{name: 'percent_done', type: 'int'},
{name: 'start_date', type: 'string'},
{name: 'end_date', type: 'string'},
{name: 'other_field', type: 'string'},
{name: 'duration', type: 'string'},
{name: 'pid', type: 'int'},
{name: 'index', type: 'int'}
]
});
var adstore = Ext.create('Ext.data.Store', {
remoteSort: true,
//設置分頁大小
remoteFilter : true,
model: 'GanttTask',
proxy: {
type: 'ajax',
url: 'taskList_query.action?task_id='+task_id,
reader: {
type: 'json',
root: 'ganttTaskList',
//獲取數據總數
totalProperty: 'totalCount'
}
},
autoLoad: false
}
);
"name":"New Task","other_field":","parent_id":null,
看看"other_field":",",這個json格式不對了
可以上在線網站校驗
http://www.bejson.com/