Hello.
Trying to load data into a form, and something does not work. 
What am I doing wrong?
I use frameworks PHP Сodeigniter,extjs-jquery-adapter
Attach a link to the event to (create) open a window with a form.
Code:
$("a.edite").live("click",function(e){
if($('tr.edit').size() == 0){
$("table.list tbody tr").removeClass('act');
$(this).addClass('act');
var real_id = $(this).attr('id');
var id=real_id.split("_");
e.preventDefault();
if(!win){
var win = new Ext.Window({
title:'Новая лаборатория',
width:600,
height:250,
resizable:false,
closable:true,
items:movie_form =new Ext.FormPanel({
labelWidth:110,
url:"<?= base_url()?>index.php/labaratories/addLabs",
frame:true,
title: 'Введите данные для новой лаборатории',
collapsible:true,
autoHeight:true,
bodyStyle: 'padding: 10px 10px 0 20px;',
modal: true,
monitorValid:true,
items : [
{
xtype : 'textfield',
fieldLabel : 'Название',
name : 'lab_name',
width:'250px'
},{
xtype : 'textarea',
fieldLabel : 'Примечание',
name : 'note',
width:'400px',
height:'100px'
}
],
buttons:[{
text:'Сохранить',
handler:function(){
movie_form.getForm().submit({
method:'POST',
waitTitle:'Please wait.......',
waitMsg:'Send data...',
success:function(form,action){
obj = Ext.util.JSON.decode(action.response.responseText);
Ext.Msg.alert('Warning!', 'Authentication server is unreachable : ' + obj.success);
},
failure:function(form, action){
if(action.failureType == 'server'){
obj = Ext.util.JSON.decode(action.response.responseText);
Ext.Msg.alert('Chage Password!', obj.errors.reason);
} else {
Ext.Msg.alert('Warning!', 'Authentication server is unreachable : ' + action.response.responseText + "abcd");
}
movie_form.getForm().reset();
}
});
}
},{
text: 'Отмена',
handler:function(){
win.close();
}
}]
})
});
}
win.show(this);
movie_form.getForm().load({
url:'<?= base_url()?>index.php/labaratories/editeLabs',
params:{
edite_id:id[1]
}
});
//movie_form.getForm().findField('lab_name').setValue('Dumb & Dumber');
}
})
Part of the controller to which the call to load the data into a form
Code:
public function editeLabs(){
$id = $this->input->post('edite_id');
$data=$this->Mlabs->getLabsonId($id);
}
The model to which the appeal comes from the Comptroller
Code:
public function getLabsonId($id){
$data = array();
$query = $this->db->get_where('lab_list', array('id' => $id));
foreach ($query->result() as $row){
$data[]=$row;
}
echo '{success: true, data:'.json_encode($data).'}';
}
From the examples I realized that for the loading of data in the form of code responsible
Code:
movie_form.getForm().load({
url:'<?= base_url()?>index.php/labaratories/editeLabs',
params:{
edite_id:id[1]
}
});
But the substitution of data in the form does not occur
Here is the server response to my inquiry
Code:
{success: true, data:[{"id":"71","note":"\u0444\u0432\u044b\u0444\u0432","lab_name":"\u0432\u044b\u0444\u0432\u044b\u0444\u0432\u0432\u044b"}]}
'll Show what my mistake