llisam
15 Oct 2007, 9:36 AM
I'm trying to get the paging footer to work with coldfusion and maybe I'm not doing the coldfusion part correctly because for some reason, even though my query returns 36 results, the paging footer always displays 1-10 (the limit I've specified).
What I'm doing on the coldfusion page is restricting the returnset to 10, but returning the totalProperty count as 36 in my cf generated xml.
Am I doing this correctly? Below is the cf page (the stored proc is returning all records now until I modify the sp to take in a start and a limit parameter) Thanks for any help!
~Lucy
<cfsetting enablecfoutputonly="yes">
<cfparam name="locationid" default="">
<cfparam name="numofdays" default="45">
<cfparam name="sortByField" default="">
<cfparam name="start" default="0">
<cfparam name="limit" default="10">
<cfset lastrunjobdt = CreateDateTime(Year(now()), Month(now()), Day(now()), 3, 0, 0)>
<CFSET xmldoc = "<?xml version=""1.0"" encoding=""UTF-8""?>
<dashboardpatients>">
<cfquery name="Get_NewPatReg_DashboardList" datasource="reg_dsn">
{CALL Get_NewPatReg_DashboardList (#locationid#, #numofdays#)}
</cfquery>
<cfparam name="end" default="#Get_NewPatReg_DashboardList.RecordCount#">
<cfif start IS NOT "">
<cfset end = start + limit>
</cfif>
<cfoutput>
<cfloop query="Get_NewPatReg_DashboardList">
<cfif Get_NewPatReg_DashboardList.CurrentRow GTE start AND Get_NewPatReg_DashboardList.CurrentRow LTE end>
<CFSET xmldoc = xmldoc & "
<patient>
<patientid>#trim(XMLFormat(patientid))#</patientid>
<createdate>#DateFormat(createdate, 'mm/dd/yyyy')#</createdate>
<lastrunjobdt>#DateFormat(lastrunjobdt, 'mm/dd/yyyy')#</lastrunjobdt>
<locationid>#locationid#</locationid>
<lastname>#trim(XMLFormat(lastname))#</lastname>
<firstname>#trim(XMLFormat(firstname))#</firstname>
<patientname>#Get_NewPatReg_DashboardList.CurrentRow# #trim(XMLFormat(UCASE(patientname)))#</patientname>
<eventtype>#trim(XMLFormat(eventtype))#</eventtype>
<startdate>#trim(XMLFormat(DateFormat(startdate, "mm/dd/yyyy")))#</startdate>
<needinfo>#trim(XMLFormat(needinfo))#</needinfo>
<needdocs>#trim(XMLFormat(needdocs))#</needdocs>
<icr>#trim(XMLFormat(icr))#</icr>
<bvf>#trim(XMLFormat(bvf))#</bvf>
<worklists>#trim(XMLFormat(worklists))#</worklists>
</patient>">
</cfif>
</cfloop>
<cfset xmldoc = xmldoc & "<total>" & Get_NewPatReg_DashboardList.Recordcount &"</total>">
</cfoutput>
<CFSET xmldoc = xmldoc & "
</dashboardpatients>">
<cfcontent type="text/xml">
<cfoutput>#xmldoc#</cfoutput>
// create the Data Store
var ds = new Ext.data.Store({
// load using HTTP
proxy: new Ext.data.HttpProxy({url: index_content_dashboard_xml.shtml?locationid=' + js_locationid + '&numofdays=' + js_numofdays}),
// the return will be XML, so lets set up a reader
reader: new Ext.data.XmlReader({
// records will have an "Item" tag
record: 'patient',
id: 'patientid',
totalProperty: 'total'
}, [
// set up the fields mapping into the xml doc
// The first needs mapping, the others are very basic
'patientid', 'createdate', 'lastrunjobdt', 'locationid', 'patientname', 'eventtype', 'startdate', 'needinfo', 'needdocs', 'icr', 'bvf', 'worklists'
])
});
var cm = new Ext.grid.ColumnModel([
{header: "MPI", width: 75, dataIndex: 'patientid', renderer: renderMPI},
{header: "Patient Name", width: 175, dataIndex: 'patientname', renderer: renderPatientName},
{header: "Event Type", width: 80, dataIndex: 'eventtype'},
{header: "Start Date", width: 80, dataIndex: 'startdate'},
{header: "Need Info", width: 65, dataIndex: 'needinfo', renderer: renderNeedInfo},
{header: "Need Docs", width: 65, dataIndex: 'needdocs', renderer: renderNeedDocs},
{header: "ICR", width: 50, dataIndex: 'icr', renderer: renderICR},
{header: "BVF", width: 50, dataIndex: 'bvf', renderer: renderBVF},
{header: "Worklists", width: 50, dataIndex: 'worklists', renderer: renderWorklists}
]);
cm.defaultSortable = true;
var grid = new Ext.grid.Grid('dashboard-grid', {
ds: ds,
cm: cm
});
grid.render();
ds.load({params:{start:0, limit:10}});
var gridFoot = grid.getView().getFooterPanel(true);
var paging = new Ext.PagingToolbar(gridFoot, ds, {
pageSize: 10,
displayInfo: true,
displayMsg: 'Displaying patients {0} - {1} of {2}',
emptyMsg: "No patients to display"
});
paging.bind(ds);
});
What I'm doing on the coldfusion page is restricting the returnset to 10, but returning the totalProperty count as 36 in my cf generated xml.
Am I doing this correctly? Below is the cf page (the stored proc is returning all records now until I modify the sp to take in a start and a limit parameter) Thanks for any help!
~Lucy
<cfsetting enablecfoutputonly="yes">
<cfparam name="locationid" default="">
<cfparam name="numofdays" default="45">
<cfparam name="sortByField" default="">
<cfparam name="start" default="0">
<cfparam name="limit" default="10">
<cfset lastrunjobdt = CreateDateTime(Year(now()), Month(now()), Day(now()), 3, 0, 0)>
<CFSET xmldoc = "<?xml version=""1.0"" encoding=""UTF-8""?>
<dashboardpatients>">
<cfquery name="Get_NewPatReg_DashboardList" datasource="reg_dsn">
{CALL Get_NewPatReg_DashboardList (#locationid#, #numofdays#)}
</cfquery>
<cfparam name="end" default="#Get_NewPatReg_DashboardList.RecordCount#">
<cfif start IS NOT "">
<cfset end = start + limit>
</cfif>
<cfoutput>
<cfloop query="Get_NewPatReg_DashboardList">
<cfif Get_NewPatReg_DashboardList.CurrentRow GTE start AND Get_NewPatReg_DashboardList.CurrentRow LTE end>
<CFSET xmldoc = xmldoc & "
<patient>
<patientid>#trim(XMLFormat(patientid))#</patientid>
<createdate>#DateFormat(createdate, 'mm/dd/yyyy')#</createdate>
<lastrunjobdt>#DateFormat(lastrunjobdt, 'mm/dd/yyyy')#</lastrunjobdt>
<locationid>#locationid#</locationid>
<lastname>#trim(XMLFormat(lastname))#</lastname>
<firstname>#trim(XMLFormat(firstname))#</firstname>
<patientname>#Get_NewPatReg_DashboardList.CurrentRow# #trim(XMLFormat(UCASE(patientname)))#</patientname>
<eventtype>#trim(XMLFormat(eventtype))#</eventtype>
<startdate>#trim(XMLFormat(DateFormat(startdate, "mm/dd/yyyy")))#</startdate>
<needinfo>#trim(XMLFormat(needinfo))#</needinfo>
<needdocs>#trim(XMLFormat(needdocs))#</needdocs>
<icr>#trim(XMLFormat(icr))#</icr>
<bvf>#trim(XMLFormat(bvf))#</bvf>
<worklists>#trim(XMLFormat(worklists))#</worklists>
</patient>">
</cfif>
</cfloop>
<cfset xmldoc = xmldoc & "<total>" & Get_NewPatReg_DashboardList.Recordcount &"</total>">
</cfoutput>
<CFSET xmldoc = xmldoc & "
</dashboardpatients>">
<cfcontent type="text/xml">
<cfoutput>#xmldoc#</cfoutput>
// create the Data Store
var ds = new Ext.data.Store({
// load using HTTP
proxy: new Ext.data.HttpProxy({url: index_content_dashboard_xml.shtml?locationid=' + js_locationid + '&numofdays=' + js_numofdays}),
// the return will be XML, so lets set up a reader
reader: new Ext.data.XmlReader({
// records will have an "Item" tag
record: 'patient',
id: 'patientid',
totalProperty: 'total'
}, [
// set up the fields mapping into the xml doc
// The first needs mapping, the others are very basic
'patientid', 'createdate', 'lastrunjobdt', 'locationid', 'patientname', 'eventtype', 'startdate', 'needinfo', 'needdocs', 'icr', 'bvf', 'worklists'
])
});
var cm = new Ext.grid.ColumnModel([
{header: "MPI", width: 75, dataIndex: 'patientid', renderer: renderMPI},
{header: "Patient Name", width: 175, dataIndex: 'patientname', renderer: renderPatientName},
{header: "Event Type", width: 80, dataIndex: 'eventtype'},
{header: "Start Date", width: 80, dataIndex: 'startdate'},
{header: "Need Info", width: 65, dataIndex: 'needinfo', renderer: renderNeedInfo},
{header: "Need Docs", width: 65, dataIndex: 'needdocs', renderer: renderNeedDocs},
{header: "ICR", width: 50, dataIndex: 'icr', renderer: renderICR},
{header: "BVF", width: 50, dataIndex: 'bvf', renderer: renderBVF},
{header: "Worklists", width: 50, dataIndex: 'worklists', renderer: renderWorklists}
]);
cm.defaultSortable = true;
var grid = new Ext.grid.Grid('dashboard-grid', {
ds: ds,
cm: cm
});
grid.render();
ds.load({params:{start:0, limit:10}});
var gridFoot = grid.getView().getFooterPanel(true);
var paging = new Ext.PagingToolbar(gridFoot, ds, {
pageSize: 10,
displayInfo: true,
displayMsg: 'Displaying patients {0} - {1} of {2}',
emptyMsg: "No patients to display"
});
paging.bind(ds);
});