Hi Andrew this is my store and ConvertQueriesForExt.cfc:
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
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm