Skip to main content
Inspiring
July 1, 2014
Question

CFGRID, was working in CF8 won't display results in CF11

  • July 1, 2014
  • 4 replies
  • 3276 views

Hi

I recently upgraded a client from CF 8 to CF 11.

In the code is a CFGRID which was working in CF8 but now in CF11 the grid displays but no data appears (the grid is simply empty).

With debugging enabled the Coldfusion Ajax Logger is reporting the following error:

Uncaught SyntaxError: Unexpected identifier (http://hiddenServer.com/index.cfm?action=job.manageJobOperations&jobId=2395&cfdebug, line 104)


Line 104 is the "</cfgrid>" tag.


Here is cfgrid code, complete with it's bound cfselect statement immediately before it:

<cfselect name="primarysupplier" query="getconcretecompanies" display="name" value="id" required="yes"  />

<cfgrid name="mixdesigns" format="html" bind="cfc:controller.Controller.getMixDesign({primarysupplier},{cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection},{primaryconcrete:jobid})" bindonload="yes" height="400" selectmode="row" sort="yes" selectonload="false">

                            <cfgridcolumn name="id" display="no" />

                                <cfgridcolumn name="selectcode" select="yes" display="yes" header="Select" width="40" />

                                <cfgridcolumn name="shortcompanyname" display="yes" header="Supplier" width="75" select="no" />

                                <cfgridcolumn name="mixnumber" display="yes" header="Mix Number" width="75" select="no" />

                                <cfgridcolumn name="psistrength" display="yes" header="PSI" width="45" select="no" />

                                <cfgridcolumn name="cubicyardprice" display="yes" header="Price" width="50" select="no" />

                                <cfgridcolumn name="description" display="yes" header="Description" width="180" select="no" />

                            </cfgrid>

I've dumped the query that populates the cfselect and there are no empty rows.

The console at the bottom of Chrome simply reports the same error, "Uncaught syntaxError. Unexpected identifier".

Has anyone else encountered this issue? If nothing else I'd love to learn how to debug this error, it seems as if there is some extra data being fed to the cfgrid but I can't seem to trap it....

Anyone?

Thanks in advance for your help,

Rich

    

    This topic has been closed for replies.

    4 replies

    Participant
    November 5, 2015

    Trying adding his to the top of your grid code as this was a pretty easy work-around:

    <body>

    <cfsavecontent variable = "javascript">

    <script type="text/javascript">

    var grid;

    function init() {

    grid=ColdFusion.Grid.getGridobject('userGrid')

    }

    </script>

    </cfsavecontent>

    <cfhtmlhead text="#javascript#">

    .... your grid code

    </cfgrid>

    </cfform>   <!--- if using a form --->

    ... Then add this to the bottom to load the grid.

    <cfset ajaxOnLoad("init")>

    </body>

    It works in IE 11...  I haven't tried all browsers.

    Joe

    Participant
    November 5, 2015

    "userGrid" is the name of your grid, just to clarify.

    Participant
    November 5, 2015

    Following up here, this works on one of my grids that actually has 2 cfforms on the page and a table within a table.  It has names down the left side of the page and then the grid displays all checking entries for whichever person you click on from the left.

    I have no idea why it doesn't work on the simple one where all there is is just a grid.

    Inspiring
    September 15, 2015

    Hi, I ran into this issue from CF9 to CF11, what you can do is:

    1. Change the bind type of your CFGRID from cfc to javascript and only keep the default cfgrid parameters. You will define the javascript function later.


    bind="cfc:controller.Controller.getMixDesign({primarysupplier},{cfgridpage},{cfgridpagesize},{c fgridsortcolumn},{cfgridsortdirection},{primaryconcrete:jobid})"
    bind="javascript:getMixDesign({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection})"


    2. Create a cfajaxproxy pointing to your cfc controller.Controller


    <cfajaxproxy cfc="controller.controller" jsclass="proxy" />


    3. Create a form with id="primaryconcrete" (it can be different you just have to know this to reference it later) and inside this form put hidden inputs with the name of your custom parameters or filter controls

    <cfform name="primaryconcrete" id="primaryconcrete">

      <cfinput name="primarysupplier" value="#primarySuplierValue#" />

        <!--- This can be any other control --->

        <cfinput name="jobid" value="#jobIdValue#">

    </cfform>


    4. Create your javascript handler referenced in your bind attribute.

    <script>

        getMixDesign = function(cfgridpage,cfgridpagesize,cfgridsortcolumn,cfgridsortdirection){

        //cfajaxproxy instance

          var instance = new proxy();

        // Get the values of the form controls to send them as arguments

        instance.setForm('primaryconcrete');

        //Return the json object obtained from the server

        return instance.getMixDesign(cfgridpage,cfgridpagesize,cfgridsortcolumn,cfgridsortdirection );

      };

    </script>

    Your cfc should remain intact.

    I hope this will help.

    Thanks.

    Angel Chrystian

    Participant
    July 1, 2015

    I just updated to CF 11 Update 5 from CF 8, and I'm experiencing this exact thing - a CFGRID that was previously working in 8, I am just getting an AJAX spinner with an error in the JavaScript console about an error parsing the JSON returned from the CFFUNCTION. Any ideas why I'm seeing this, since it should have been fixed 4 updates ago?

    Anit_Kumar
    Inspiring
    July 2, 2015

    Hi Dave,

    Can you check Home for existing bug, if any? If not, please log a new one.

    Thanks

    Regards,

    Anit Kumar

    Anit_Kumar
    Inspiring
    July 1, 2014
    Inspiring
    July 1, 2014

    Hi Anit

    Thanks for your response.

    I didn't see that Adobe posted a fix for this, do you have a suggested workaround? It looks like the bug was closed, any ideas on how to fix this issue?

    Thanks,

    Rich

    Anit_Kumar
    Inspiring
    July 1, 2014

    Hi Rich,

    The issue is fixed in ColdFusion 11 Update 1. That is why the bug is closed. You can go ahead and vote/subscribe to the bug.

    Regards,

    Anit Kumar