View Full Version : Cannot save edited grid cell on the server using ColdFusion

5 Mar 2012, 11:32 AM
I am wrestling 2 weeks now to build an “editable” grid with Extjs and ColdFusion. It is needless to say that I have not any results! I tried this with “JSON” data (you can see the related post on: http://www.sencha.com/forum/showthread.php?183909-ColdFusion-and-Extjs4) and I am failing. So I gave a shot to “XML” data. Again a total failure! The funny part on this effort is that when I am posting static data to the “parse.cfm” without the ExtJs , everything is working as they supposed to. But when Ext posting data nothing happens (i have the same problem when I am using “JSON”).The point is that I what to purchase ExtJS4 but having these sort of problems make me skeptical. The sure thing is that I am new in ColdFusion and Ext as also. So I don’t know what to blame (CF or Ext – maybe both!). I am trying to find help on this, desperately.

Greece (or what's left of it!)

Below is the code that I am using:

THE index.cfm

<link rel="stylesheet" type="text/css" href="../ext/resources/css/ext-all.css">
<style type="text/css">
#holder {
margin: 50px auto auto 200px;
padding: 0px;
#members {
float: left;
clear: left;
<script type="text/javascript" src="../ext/ext-all.js"></script>
<script type="text/javascript" src="js/app.js"></script>


<div id="holder">
<div id="members"></div>


THE app.js

Ext.onReady(function() {

/*var rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
clicksToMoveEditor: 1,
removePhantomsOnCancel: true,
autoCancel: false

extend: 'Ext.data.Model',
idProperty: 'ID',
fields: [{name:'ID'},
{name:'TIME',type:'date',dateFormat:'d-m-Y H:i'}

var membersStore = Ext.create('Ext.data.Store',{
model: 'memModel',
autoSync : true,
autoSave: true,
autoLoad: true,
proxy: new Ext.data.HttpProxy({
type: 'ajax',
noCache : false,
actionMethods: {
create : 'POST',
read : 'POST',
update : 'POST',
destroy: 'POST'
api: {
read: 'http://localhost:8500/EXTJS4_XML/GRID1/members.cfm',
update: 'http://localhost:8500/EXTJS4_XML/GRID1/parse.cfm',
create: 'http://localhost:8500/EXTJS4_XML/GRID1/members.cfm'
reader: {
type: 'xml',
root: 'ROWS',
record: 'member'
writer: {
type: 'xml',
record: 'member'

var members = Ext.create('Ext.grid.Panel', {
id: 'members',
store: membersStore,
selType: 'rowmodel',
columns: [{
id: 'id',
header : 'ID',
width: 35,
dataIndex: 'ID'
header : 'Firstname',
flex : 1,
sortable : false,
dataIndex: 'FIRSTNAME',
editor: {
xtype: 'textfield',
allowBlank: false
header : 'Lastname',
flex : 1,
sortable : false,
dataIndex: 'LASTNAME',
editor: {
xtype: 'textfield',
allowBlank: false
header : 'Email',
flex : 2,
sortable : false,
dataIndex: 'EMAIL',
editor: {
xtype: 'textfield',
allowBlank: false
id : 'time',
header : 'Creation Date',
flex : 1,
dataIndex: 'TIME',
//renderer: Ext.util.Format.dateRenderer('d-m-Y'),
/*editor: {
xtype: 'datefield',
allowBlank: false
renderer: function(field) {
var formated = Ext.util.Format.date(field, 'd-m-Y g:i A');
return formated;
xtype: 'actioncolumn',
sortable : false,
width: 80,
items: [{
id: 'edit',
icon: 'images/edit.png',
tooltip: 'Edit',
handler: function (grid, rowIndex, colIndex) {
var rec = grid.getStore().getAt(rowIndex);
//Ext.MessageBox.alert('Edit', rec.get('LASTNAME'));
id: 'update',
icon: 'images/update.png',
tooltip: 'Update',
handler: function (grid, rowIndex, colIndex) {
var rec = grid.getStore().getAt(rowIndex);
Ext.MessageBox.alert('Update', rec.get('LASTNAME'));
id: 'delete',
icon: 'images/delete.png',
tooltip: 'Delete',
handler: function (grid, rowIndex, colIndex) {
//var rec = grid.getStore().getAt(rowIndex);
var sm = members.getSelectionModel();
//Ext.MessageBox.confirm('Delete', 'Are you sure that you whant to delete' + ' ' + '\'' + rec.get('LASTNAME') + '\'');

width: 680,
//height: 200,
autoScroll: true,
//hidden : true,
renderTo: 'members',
plugins: [/*rowEditing*/
// Edit cell by cell
clicksToEdit: 1

// Edit row by row
clicksToEdit: 1

THE members.cfm --------responsible for the data load---------

<cfsetting enablecfoutputonly="yes">
<cfsetting showdebugoutput="no">
<!--- Query the database and get all the records from the Images table --->
<cfquery name="selUsers" datasource="rental">
SELECT rental.members.id,
DATE_FORMAT(time,'%d-%m-%Y %H:%i:%s') AS time
FROM rental.members
<!--- Send the headers --->
<cfheader name="Content-type" value="text/xml">
<cfheader name="Pragma" value="public">
<cfheader name="Cache-control" value="private">
<cfheader name="Expires" value="-1">
<cfsetting enablecfoutputonly="no"><?xml version="1.0" encoding="utf-8"?>
<cfoutput query="selUsers">

THE parse.cfm --------responsible for the unsuccessful data saving---------

<cfhttp url="http://localhost:8500/EXTJS4_XML/GRID1/index.cfm" method="GET" resolveurl="No" result="Urlfeed"></cfhttp>
<cfset myfeed = XmlParse(Urlfeed.FileContent)/>
<!--- <cffile action="read" file="C:\ColdFusion9\wwwroot\EXTJS4_XML\GRID1\member.xml" variable="myxml">
<cfset myfeed = XmlParse(myxml)>--->

<cfmail subject="XML" from="CF_Server" to="rigasathanasios78@hotmail.com" >

<!--- Get record nodes. --->
<cfset recordNodes = xmlSearch( myfeed, "/xmlData/member" ) />
Loop over the nodes so that we can insert each one into
the database.

<cfset valueNodes = xmlSearch( recordNode, "./*/text()" ) />

<cfset id = recordNode.xmlChildren[ 1 ].xmlText />
<cfset firstname = recordNode.xmlChildren[ 2 ].xmlText />
<cfset lastname = recordNode.xmlChildren[ 3 ].xmlText />
<cfset email = recordNode.xmlChildren[ 4 ].xmlText />
<cfset time = recordNode.xmlChildren[ 5 ].xmlText />

<!--- Update the values into the database. --->
<cfquery name="update" datasource="rental">
UPDATE rental.members
SET rental.members.id = <cfqueryparam value="#id#" cfsqltype="cf_sql_integer" />,
rental.members.firstname = <cfqueryparam value="#firstname#" cfsqltype="cf_sql_varchar" />,
rental.members.lastname = <cfqueryparam value="#lastname#" cfsqltype="cf_sql_varchar" />,
rental.members.email = <cfqueryparam value="#email#" cfsqltype="cf_sql_varchar" />,
time = <cfqueryparam value="#time#" cfsqltype="cf_sql_timestamp" />
WHERE rental.members.id = <cfqueryparam value="#id#" cfsqltype="cf_sql_integer" />


5 Mar 2012, 11:40 AM
When your store fires off the sync request to the server, have you looked at the request to see what is being sent?

5 Mar 2012, 11:52 AM
It is says server error. This doesn't make sense. As i already said my ColdFusion can consume static "XML" data.

5 Mar 2012, 11:53 AM
And i don't understand why this is working in Extjs 3.0 version?

5 Mar 2012, 11:56 AM
In few words the error says that the posted data cannot be parsed!

19 Jul 2012, 2:01 PM
It is says server error. This doesn't make sense. As i already said my ColdFusion can consume static "XML" data.

"Server error" usually means some issue on the CF side related to CF page handling the data. One way I have found useful to test these situations with CF is to turn debugging on on the CF Server then set up a CF test page that sends the data to your api handlers directly - ie leave Ext out of the equation and just get the CF working independently of the the Ajax call. Use CFDUmp etc to track the data as the page handles the request. Once you are certain that the CF page is working as expected, try again from Ext.

I hope that helps. And, I have never used XML in these situations, only JSON, so I have no experience with what you are attempting.


19 Jul 2012, 9:19 PM
Thank you for your answer