~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349422
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349423
Steve 'Cutter' Blades
Adobe Community Professional
Adobe Certified Expert
Advanced Macromedia ColdFusion MX 7 Developer
____________
http://cutterscrossing.com
Co-Author "Learning Ext JS 3.2" Packt Publishing 2010
https://www.packtpub.com/learning-ext-js-3-2-for-building-dynamic-desktop-style-user-interfaces/book
"The best way to predict the future is to help create it"
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349425
Ext.define('MyApp.store.UserStore', {
extend: 'Ext.data.Store',
constructor: function(cfg) {
var me = this;
cfg = cfg || {};
me.callParent([Ext.apply({
autoLoad: true,
storeId: 'UserStore',
proxy: {
type: 'ajax',
url: '/orm_2/view/user/app/store/ConvertQueriesForExt.cfc',
reader: {
type: 'json',
idProperty: 'name',
root: 'users'
}
},
fields: [
{
name: 'user_pk',
allowBlank:false,
type: 'int'
},
{
name: 'email',
sortType: 'asText',
type: 'string'
},
{
name: 'isactive',
type: 'boolean'
},
{
name: 'userroleid',
sortType: 'asInt',
type: 'int'
}
]
}, cfg)]);
}
});
----------------------------------------
<cfcomponent output="false">
<cffunction name="getUsers" access="remote" returnformat="json" output="false" hint="Gets list/detail of posts">
<cfargument name="limit" type="numeric" required="no">
<cfargument name="start" type="numeric" required="no">
<cfargument name="sort" required="no" type="string">
<cfset var userData = "">
<cfquery name="userData" datasource="orm_2">
SELECT user_pk,email,isactive,userroleid
FROM users
ORDER BY #arguments.sort#
</cfquery>
<cfset clist = 'user_pk,email,isactive,userroleid'>
<cfset arrayRecords = convertQueryToExtJSON(userData,clist,arguments.limit,arguments.start)>
<cfset s = {rows=arrayRecords,dataset=#userData.recordcount#}>
<cfreturn s />
</cffunction>
<cffunction name="ConvertQueryToExtJSON" returntype="any" access="public">
<cfargument name="query" type="query" required="yes" />
<cfargument name="clist" type="string" required="yes" />
<cfargument name="limit" type="numeric" required="yes" />
<cfargument name="start" type="numeric" required="yes" />
<cfscript>
arrayRecords = ArrayNew(1);
if(arguments.start==0) {
counter = 1;
}
else {
counter = arguments.start;
}
for(i=1;i<=arguments.limit;i++) {
strResults = structNew();
for(x=1;x<=listLen(clist);x++) {
strResults[ucase(listGetAt(clist,x))] = query[listGetAt(clist,x)][counter];
}
arrayRecords[i] = strResults;
counter = counter+1;
}
return arrayRecords;
</cfscript>
</cffunction>
</cfcomponent>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349426
Might I suggest using FireFox with with Firebug and / or Chrome console to
show us what your Json is being returned. I am convinced by looking at the
code that a Json Array is not being handled here.
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349433
{"ROWS":[{"EMAIL":"s....@gosh.org.uk","USER_PK":"1","ISACTIVE":"1","USERROLEID":"1"}],"DATASET":"1"}
Thanks
Tom
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349435
HTH
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349436
Thanks
Tom
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349437
If you post the code for a snippet of your Grid, we can show you what we
mean.
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349438
-----------------------
Ext.define('MyApp.view.ui.UsersDetail', {
extend: 'Ext.panel.Panel',
style: "margin: 0px auto 0px auto;", // center the form panel
frame: true,
height: 450,
width: 410,
autoScroll: true,
layout: {
align: 'stretch',
type: 'vbox'
},
title: '<span class="gridPanelText">Users</span>',
initComponent: function() {
var me = this;
Ext.applyIf(me, {
items: [
{
xtype: 'gridpanel',
itemId: 'grid',
store: 'UserStore',
flex: 1,
columns: [
{
xtype: 'numbercolumn',
width: 40,
dataIndex: 'user_pk',
format: 0
},
{
xtype: 'gridcolumn',
width: 165,
dataIndex: 'email',
text: 'Email'
},
{
xtype: 'booleancolumn',
width: 80,
dataIndex: 'isactive',
text: 'Is Active'
},
{
xtype: 'numbercolumn',
width: 90,
dataIndex: 'userroleid',
text: 'Role',
format: 0
}
],
viewConfig: {
}
}
],
dockedItems: [
{
xtype: 'toolbar',
flex: 1,
dock: 'top',
items: [
{
xtype: 'button',
iconCls: 'addIcon',
text: 'Add'
},
{
xtype: 'button',
iconCls: 'editIcon',
text: 'Edit'
},
{
xtype: 'button',
iconCls: 'deleteIcon',
text: 'Delete'
},
{
xtype: 'tbseparator'
},
{
xtype: 'button',
iconCls: 'importIcon',
text: 'Import'
},
{
xtype: 'tbseparator'
},
{
xtype: 'button',
iconCls: 'exportIcon',
text: 'Export'
}
]
},
{
xtype: 'toolbar',
flex: 1,
dock: 'top',
items: [
{
xtype: 'textfield',
width: 323
},
{
xtype: 'tbspacer'
}
]
}
]
});
me.callParent(arguments);
}
});
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349442
See these type of lines
dataIndex: 'email',
This tells the grid to index the data in the store, so in this case you
will need to make it
dataIndex: 'EMAIL',
Hope that helps.
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349443
HTH
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349447
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349453
Problem solved and thanks for all your help and support.
Tom
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349456
Problem solved and thanks for all your help and support.
Tom
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349457
Problem solved and thanks for all your help and support.
Tom
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349458