Skip to main content
Inspiring
January 18, 2012
Question

rendering cfgrid through js

  • January 18, 2012
  • 1 reply
  • 819 views

i have a html cfgrid that should be populated by a cfc

to the cfc i'm passing 4 column names and a string (as form field values)

this works fine with a cfinvoke, when page loads first. but now i want to be able to pass different values to cfc and reload my grid with the new values.

 

i've created a proxy <cfajaxproxy cfc="repfunc" jsclassname="rproxy" />

  

created a js function:

function srcCxReqs(srcReqs,f1,f2,f3,f4) {

         var instance = new rproxy();

         instance.srcCxReqs(srcReqs,f1,f2,f3,f4);

         ColdFusion.Grid.refresh('testgrid');

     }

  

created a button that collects (correctly) the values to pass and calls the js function:

<button name="getReqs" onClick="srcCxReqs(getElementById('srcReqs').value, getElementById('f1').options[f1.selectedIndex].value, getElementById('f2').options[f2.selectedIndex].value, getElementById('f3').options[f3.selectedIndex].value, getElementById('f4').options[f4.selectedIndex].value)">

  

<cfgrid name="testgrid" format="html" query="cxReqs"></cfgrid>

  

but when i try it, get "Exception thrown and not caught, cfajax.js, Code:0

i'm not even sure the cfajaxproxy is the right way to do it.

does anybody have a working example of a cfgrid being renedered again by a js function?

 

thanks

This topic has been closed for replies.

1 reply

ionAuthor
Inspiring
January 19, 2012

getting desperate, at this point i would settle even for "how to reload a cfgrid by clicking on a button"

even this throws an "object does not support this property or method"

<cfajaxproxy cfc="repfunc" jsclassname="rproxy" />

function refreshGrid() {

        var instance = new rproxy();

        myGrid=ColdFusion.getGridObject('testgrid');

        myGrid.getStore();

        ColdFusion.Grid.refresh('testgrid');

    }

<input type="button" name="getReqs" value="Refresh"  onClick="refreshGrid()">

<cfgrid name="testgrid" format="html" query="cxReqs"></cfgrid>

thanks for any help