tracker issue : CF-4073889

select a category, or use search below
(searches all categories and all time range)
Title:

ColdFusion.Grid.refresh not honoring preservepage

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/

Reporter/Name(from Bugbase): Craig Akers / Craig Akers (Craig Akers)

Created: 10/14/2015

Components: AJAX, UI Components

Versions: 11.0

Failure Type: Incorrect w/Workaround

Found In Build/Fixed In Build: CF11_Final /

Priority/Frequency: Normal / Some users will encounter

Locale/System: English / Win 2008 Enterprise Svr

Vote Count: 1

Problem Description:ColdFusion.Grid.refresh('grid01', true); does not preserve the current page of the grid.

Steps to Reproduce:
Create an HTML format grid using CFGRID:
<cfgrid format="html" name="grid01" pagesize=30 stripeRows=false fontSize=10px font="Arial" colHeaderFontSize=8px
            bind="cfc:ProjQuote.getData({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection})" 
            delete="No" selectmode="edit" selectonload="no"
            onchange="cfc:ProjQuote.editData({cfgridaction},{cfgridrow},{cfgridchanged})">

Load the grid with data to exceed the pagesize of 30.
Use the bottom toolbar to navigate to page 2 of the grid.
Select or edit a cell.
Call ColdFusion.Grid.refresh('grid01', true); from a link on the page.

Actual Result:
The grid refreshes, but returns to page 1.

Expected Result:
The grid refreshes and maintains the current page.

Any Workarounds:

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	4073889

External Customer Info:
External Company:  
External Customer Name: Craig Akers
External Customer Email:  
External Test Config: My Hardware and Environment details:

ColdFusion 11, Update 5 on Windows 2008 Server Enterprise.

IE 11 Browser.

Attachments:

Comments:

Hi Craig, I'm unable to observe the issue on CF11u5. clicking the the refresh button in the bottom toolbar after navigating to page 2 or later, does not reset the grid back to page 1. It stays on the current page. Can you share the relevant code in your :ProjQuote.getData and :ProjQuote.editData method? Also do you observe any errors in your browser debugger when you hit the browse button. You can share the code here or you can mail it to me at pnayak@adobe.com
Comment by Piyush K.
5563 | October 19, 2015 03:44:38 AM GMT
No errors are observed in debugger at any time. Navigate to page 2 or later, then click the link. Grid will refresh with page 1 loaded. I have duplicated these results on a page stripped down to only the essential code. I will try to provide a test case utilizing a demo database when I can find time. Here is the link on the page that calls the refresh: <a href="##" onclick="ColdFusion.Grid.refresh('grid01', true);">Refresh</a> ProjQuote.getData: <cffunction name="getData" access="remote" output="false"> <cfargument name="page"> <cfargument name="pageSize"> <cfargument name="gridsortcolumn" default=""> <cfargument name="gridsortdirection" default=""> <cfset query = 'SELECT * FROM projectquote_lineitems where quoteid = #client.quoteid#'> <cfif NOT Trim(arguments.gridsortcolumn) is ''> <cfset query=query & ' order by #gridsortcolumn# #gridsortdirection#'> <cfelse> <cfset query = query & 'order by id'> </cfif> <cfquery name="get_data" datasource="ftwarehousing"> <cfoutput>#query#</cfoutput> </cfquery> <cfreturn QueryConvertForGrid(get_data, page, pageSize)> </cffunction> ProjQuote.editData: <cffunction name="editData" access="remote"> <cfargument name="gridaction"> <cfargument name="gridrow"> <cfargument name="gridchanged"> <cfif isStruct(gridrow) and isStruct(gridchanged)> <cfif gridaction eq "U"> <cfset colname=structkeylist(gridchanged)> <cfset value=structfind(gridchanged,#colname#)> <cfif isnumeric(value)> <cfset ischar = 0> <cfelse> <cfset ischar = 1> </cfif> <cfquery name="update" datasource="dsn"> update projectquote_lineitems set <cfoutput>#colname#</cfoutput> = <cfif ischar> <cfif value is ''> NULL <cfelse> <cfoutput>'#value#'</cfoutput> </cfif> <cfelse> <cfif value is ''> NULL <cfelse> <cfoutput>#value#</cfoutput> </cfif> </cfif> where id = <cfoutput>#gridrow.id#</cfoutput> </cfquery> <cfelse> <cfquery name="delete" datasource="dsn"> delete from projectquote_lineitems where id = <cfoutput>#gridrow.id#</cfoutput> </cfquery> </cfif> </cfif> </cffunction>
Comment by External U.
5564 | October 23, 2015 07:40:03 PM GMT
I have found a workaround using the underlying Ext framework that solves the problem in this instance. The workaround preserves the current page while refreshing the grid. This is how ColdFusion.Grid.refresh should work when including the preservepage attribute. Change the refresh link to: <a href="##" onclick="javascript: refreshGrid();">Refresh</a> And add the following function: <InvalidTag type="text/javascript"> function refreshGrid() { grid = ColdFusion.Grid.getGridObject("grid01"); //get the grid object current = grid.store.currentPage; grid.store.loadPage(current); } </script>
Comment by External U.
5565 | October 24, 2015 10:37:17 AM GMT
Same here -- Windows 2012 Server with CF11 Update 5.
Vote by External U.
5568 | November 25, 2015 12:45:11 PM GMT
appears to be fixed in HF7. verified with b.11,0,07,296330 (also verified to be working in 11,0,09,299201) The issue was introduced with HF5 (11,0,05,293506). It is not observed with HF4.
Comment by Piyush K.
5566 | June 15, 2016 01:18:51 AM GMT
Craig, Can you pls. confirm if you can still observe the issue with CF11 update 7 or later. seems fixed in these updates.
Comment by Piyush K.
5567 | June 15, 2016 01:26:57 AM GMT