javascript - Sencha ExtJS Json Transformation -


so, making login form.

sencha expecting json response typically have following format:

{     "root" : {     "success": true/false,     "message": ...,     "id": ...,     "metadata": ...,   } } 

however, actualy json response got looks this:

{   "sessionid":"1", //doesn't exist if login error   "username":"admin", //doesn't exist if login error   "responsestatus":{     //blank or failed login error list    } } 

the format 3rd party, can't change it. not straight forward map these fileds because of different structures.

my gut feeling telling me should write custom json data transformation in ext.form -> reader/errorreader -> functions. however, new extjs , don't have brain juice glue together. please help?

you don't need custom reader per johan.

if json doesn't have root, don't tell reader use root...

ext.define('my.model.model1', {     extend:'ext.data.model',     fields:[     'sessionid',     'username'     ],     proxy:{       type:'ajax',       url:'./app/data/response.json',       reader:{         type:'json',         messageproperty:'responsestatus'       }     } }); 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -