Javascript/Sencha
Sencha Grid 405에러 415에러 처리
바리새인
2024. 11. 26. 22:05
405에러: Post방식으로 호출해야 하는데, Get방식으로 호출했기 때문에 발생
415에러: Media Type이 정의되지 않아서 발생
Ext.create('Ext.data.Store', {
storeId: 'nodeStore', // Assign an ID for easy reference
fields: ['DATA1', 'DATA3', 'DATA8', 'DATA2'], // Define fields
proxy: {
type: 'ajax', // Use Ajax to fetch data
url: '/Node/getNode2List.do', // Server endpoint to fetch data
actionMethods: {
read: 'POST' // Specify that the "read" operation (load) should use POST
},
headers: {
'Content-Type': 'application/json; charset=utf-8' // Set the Content-Type header
},
reader: {
type: 'json', // Data format returned by the server
rootProperty: 'result' // Root property containing data array
},
extraParams: {
param1: 'value1', // Additional parameters to send in the request body
param2: 'value2'
},
writer: {
type: 'json' // Serialize request parameters as JSON
}
},
autoLoad: true // Automatically load data when the store is created
});