아래의 상황에서 도와주세요.ExtJs Grid가 응답 텍스트에 따라 업데이트되지 않습니다.
내 Java 웹 응용 프로그램은 JSON을 데이터 교환 형식으로 사용합니다. 달리면서. firebug (firefox)는 예상대로 JSON 데이터뿐 아니라 응답도 표시합니다. 그리드가 예상대로 업데이트되지 않고 비어 있습니다. 아래는 상점 및 그리드 정의입니다.
//Grid & Store definition
var searchResultStore = Ext.create('Ext.data.JsonStore', {
model : 'BookModel',
proxy : {
type : 'ajax',
reader : {
totalProperty : 'results',
type : 'json',
root : 'data'
}
},
autoLoad : true
});
Ext.define('Library.SearchBookGrid', {
extend : 'Ext.grid.Panel',
alias : 'widget.SearchBookGrid',
id : 'searchBookGrid',
title : 'Books',
closable : true,
initComponent : function() {
this.store = searchResultStore;
this.columns = [ {
xtype : 'gridcolumn',
dataIndex : 'title',
text : 'Title'
}, {
xtype : 'gridcolumn',
dataIndex : 'authorName',
text : 'Author'
} ];
this.callParent(arguments);
}
});
BOOK SEARCH ExtJS 양식이 있습니다. URL (/ MyLibrary/Books? action = 6) &을 호출하면 검색 양식 값이 JSONDATA로 제출됩니다. 검색 결과는 저장소 (searchResultStore)에 따라 할당됩니다.
Ext.Ajax.request({
url : '/MyLibrary/Books?action=6',
headers: {'Content-Type':'application/json; charset=utf-8'},
jsonData : Ext.JSON.encode(form.getValues()),
params:{
action : 6
},
method : 'POST',
success : function(response, request) {
searchResultStore.loadData(Ext.JSON.decode(response.responseText));
},
failure : function(results, request) {
Ext.Msg.alert("Search..", "Please try again...!!");
},
});
는 ... ... 도와주세요 난 아무것도 그리워하거나 내가이 코드에서 잘못된 생각 했습니까 !!!!
미리 감사드립니다 ... !!
독자는, 가게 부하 아약스 요청에 사용되는 수행 할 수있는 PARAMS 참조하십시오. 루트 데이터 속성 안에 있지 않을 수도 있습니다. 아마도 당신의 문제 일 수 있습니다. – nscrob
응답 해 주셔서 감사합니다. nscrob; 말하려는 것 ... 응답 텍스트는 JSONObject 대신 JSONArray 여야합니다 ... 제발 바로 잡으십시오 ... !! –