-
9 Jul 2012 3:37 AM #1
Unanswered: checkcolumn false returns a NULL
Unanswered: checkcolumn false returns a NULL
I've a MVC schedule. When I do an update, the store->proxy fires an php file. But if the value of the checkcolumn is false then it sends a NULL value, so the UPDATE don't have the value. It works fine if the checkcolumn is true and I want to chage it to false. I've been looking for it in other threats but I didn't find nothing related with.
-
9 Jul 2012 3:54 AM #2
Please provide config of model and column
-
9 Jul 2012 5:58 AM #3
view
modelCode:Ext.define("Bleext.f.view.TicketsGrid",{ extend : "Ext.grid.Panel", store : "Bleext.f.store.Tickets", border : false, rowEditor: Ext.create('Ext.grid.plugin.RowEditing', { clicksToEdit: 2 }), initComponent : function() { var me = this; me.columns = { items:[ {xtype: 'checkcolumn',header:"Ok",dataIndex:"Ok"}, {header:"Id_Article",dataIndex:"Id_Article",editor: 'textfield'} ], defaults: { flex: 1} }; me.callParent(); this.plugins = [ this.rowEditor ]; } });
storeCode:Ext.define("Bleext.f.model.Ticket",{ extend : "Ext.data.Model", //<-- Herencia fields : [ {name:"Ok",type:"integer"}, {name:"Id_Article",type:"integer"} ] });
When I click on the checkbox, the firebug writes thatCode:Ext.define("Bleext.f.store.Tickets",{ extend : "Ext.data.Store", model : "Bleext.f.model.Ticket", autoSync: true, autoLoad: true, proxy: { type: 'ajax', url : 'data/api.php', api: { create : 'data/apiu.php', read : 'data/api.php', update : 'data/api.php?action=update', destroy : 'data/api.php' }, reader: { type: 'json', root: 'data' }, writer: { type: 'json', root: 'data', writeAllFields : true } } });
php fileCode:({"success":true,"data":{"Ok":true,"Id_Article":4369126}})
So, the Ok field don't have value so, after that the Update cannot work properlyCode:$r = json_decode($HTTP_RAW_POST_DATA,TRUE); echo print_r($r);
Array( [data] => Array ( [Ok] => [Id_Article] => 4369126 [id] => ))
-
9 Jul 2012 6:33 AM #4
Try to change field config to:
{name:"Ok",type:"boolean"},
-
9 Jul 2012 10:41 PM #5
I did, now if Ok old-value = false and new-value = true it works, because it returns me Ok=1, as you can see below.
The problem comes when I want to change it from old-value = true to new-value = false, because it returns me Ok = (nothing or null), so my UPDATE doesn't work.Code:Array(
[data] => Array ([Ok] => 1 [Id_Article] => 4369126 [id] =>))
-
9 Jul 2012 11:37 PM #6
PHP print_r function don't print false values -
The preferred method for accessing the raw POST data is php://input. $HTTP_RAW_POST_DATA is not available with enctype="multipart/form-data"Code:redraid@office:~> cat test.php <?php $a = array( 'false_key' => false, 'true_key' => true, ); print_r($a); var_dump($a); ?> redraid@office:~> php -f test.php Array ( [false_key] => [true_key] => 1 ) array(2) { ["false_key"]=> bool(false) ["true_key"]=> bool(true) }
PS. For debug ajax apps i recommend firebug+firephpPHP Code:<?php $postdata = file_get_contents("php://input"); ?>
-
10 Jul 2012 4:20 AM #7


Reply With Quote