Hi! I have an editable Grid using php+mysql. When I try to edit cell, I have an empty $_POST.
Scrinshot from firebug (+ result from edit.php with var_dump($_POST)):
1.jpg
2.jpg
view.js:
Code:
Ext.onReady(function() { var cols = [
{ dataIndex: 'id', header: 'id', hidden: true },
{ dataIndex: 'title', header: 'Title', width: 200, editor: 'textfield' },
{ dataIndex: 'author', header: 'Author', width: 200, editor: 'textfield' },
{ dataIndex: 'isbn', header: 'ISBN', width: 100, editor: 'numberfield' },
],
fields = [];
for(var i=0; i<cols.length; i++) {
fields.push(cols[i].dataIndex);
}
Ext.define('Book', {
extend: 'Ext.data.Model',
fields: fields
});
var store = Ext.create('Ext.data.JsonStore', {
model: 'Book',
proxy: {
type: 'ajax',
actionMethods: {
create: 'POST',
read: 'POST',
update: 'POST',
destroy: 'POST'
},
api:{
read: 'view.php',
update: 'edit.php'
}},
reader: {
type: 'json'
//root: 'data'
},
writer: new Ext.data.writer.Json({
writeAllFields: true
})
});
Ext.create('Ext.grid.Panel', {
columns: cols,
tbar: [
{
text: 'Save',
handler: function(){
//var up = getUpdatedRecords();
store.sync()
}
}
],
width: 520,
style: 'margin-top: 5%; margin-left: 35%',
plugins: [
Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 2
})
],
renderTo: Ext.getBody(),
store: store
});
store.load();
});
view.php
PHP Code:
<?php
require_once 'db.php';
$result = mysql_query('SELECT * FROM books');
while ($row = mysql_fetch_assoc($result)) {
for ($i=0; $i < mysql_num_fields($result); $i++) {
$meta = mysql_fetch_field($result, $i); }
$rows[] = $row;
}
print (json_encode($rows));
?>
edit.php
PHP Code:
<?php
require_once 'db.php';
ini_set('display_errors', 1);error_reporting(E_ALL);
var_dump($_POST);?>
Help me please with my problem! Thank you.