1 Reply Latest reply on Jan 19, 2012 10:07 AM by ion

    rendering cfgrid through js

    ion

      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

        • 1. Re: rendering cfgrid through js
          ion Level 1

          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