I work with MVC
I have a model and a store
Code:
Ext.define('MetExplore.model.Annotation', {
extend: 'Ext.data.Model',
fields: [{name:'id',type:'string'},
{name:'table',type:'string'},
{name:'field',type:'string'},
{name:'name',type:'string'},
{name:'dbIdentifier',type:'string'},
{name:'oldV',type:'string'},
{name:'newV',type:'string'}
]
});
Ext.define('MetExplore.store.S_Annotation',{
extend : 'Ext.data.ArrayStore',
model: 'MetExplore.model.Annotation',
id: 'annotation'
});
In controller, i add data in the store when the user change
Code:
.....
init: function() {
this.control(
{'gridReaction': {
edit:this.editChange},
'gridReaction button[action=ReactionChange]':{click:this.ReactionChange},
...
editChange: function(editor,e){
//il faudra verifier qu'il n'y a pas deja cet enregistrement dans tableau
var oldV= e.originalValue;
var newV= e.value;
if (oldV != newV) {
//ajout dans tableau : id/ field / oldValue / NewValue
var annot= Ext.getStore('S_Annotation');
annot.add({'id':e.record.get('id'),'table':'Reaction','field':e.field,'name':e.record.get('name'),'dbIdentifier':e.record.get('dbIdentifier'),'oldV':oldV,'newV':newV});
};
...
this is ok
when the user click on button 'ReactionChange' , i want to send the data to php file in json format like this :
[{'id':10,'table':'Reaction','field':name',.....},
{'id':....
In my code i send an Extjs object and i can't read it in php ; i want just the array with the data and not constructor,.....
Code:
buttons : [ {
text : 'Submit',
handler :
function(widget, event) {
var annot= Ext.getStore('S_Annotation');
//var jsonModif= Ext.encode(annot);
var jsonModif= annot.getRange();
console.log(jsonModif);
Ext.Ajax.request({
url:'lib/php/changereaction_v1.php',
params: {Reactions:jsonModif},//,idUser:idUser}
How can i make this
Thank you