jeudi 11 septembre 2014

Dynamic View and Model

Hi

We need to create the Dyamnic View/Model .. All the required data comes as JSON from server.


We are able to create the Dyanmic View, But stuck with creating Model with dynamic fields and assign same to View.


Below is sample Code which we have done.


Please suggest now we can proceed.


Ext.define('Sample.view.fw.FormPanel',

{

extend :'Ext.form.Panel',

width: 340,

bodyPadding: 5,

waitMsgTarget: true,


requires: ['Sample.view.fw.FormModel'],


model:'Sample.view.fw.FormModel', // Please refer to Form Model below..


listeners:

{

afterRender:function()

{


debugger;

var formIdPass = this.id;

Ext.Ajax.request(

{

url : 'json/registration.json',

success : function(response, opts)

{

debugger;

var data = response.responseText;

Ext.getCmp(formIdPass).add(Ext.JSON.decode(response.responseText));

},

failure : function(){


}

});

}

}

});


Ext.define('Buzzor.view.fw.FormModel', {

extend: 'Ext.data.Model',


fields:[...], // Fields here needs to be dynamic


});


Thanks in Advance...






Dynamic View and Model

Aucun commentaire:

Enregistrer un commentaire