0 Replies Latest reply on Apr 25, 2006 12:53 AM by jedale

    cfgrid, showing and hiding columns w/ actionscript

    jedale
      I am trying to get my grid and some checkboxes to integrate with each other in order to show and hide different columns through actionscript. I am using the code found at this website: http://www.asfusion.com/blog/entry/mxna-reader-built-with-cfforms
      and I have been having no luck in trying to implement it. I would like to do away with the .as files that come along with this code but I can't get it to work with or without it. Does anybody know how to do this, I am at a loss and I need to get it working soon.

      Thanks in advance!
      Jeff

      Here's the code I have been working with:
      <cfformitem type="script">
      <!---
      function _global.hideColumns()
      {
      _global.postColumns = [];
      for(var i =0; i< contactList2.columnCount; i++)
      {
      _global.postColumns.push(posts.getColumnAt(i));
      }
      contactList2.removeColumnAt(6);
      contactList2.removeColumnAt(5);
      contactList2.removeColumnAt(4);
      contactList2.removeColumnAt(3);
      }

      function _global.setColumn(target, col)
      {
      if(target.value)
      {
      contactList2.addColumn(_global.postColumns[col.index]);
      contactList2.spaceColumnsEqually();
      contactList2.getColumnAt(0).width = 0;
      }
      else
      {
      for(var i = 0; i< contactList2.columnCount; i ++)
      {
      if(contactList2.getColumnAt(i).columnName == col.data)
      {
      contactList2.removeColumnAt(i);
      }
      }

      }
      </cfformitem>

      <cfform action="#cgi.script_name#" method="post" name="form" preservedata="true" preloader="yes" format="flash" height="605" width="765" skin="haloblue" style="themeColor:##56A1E1; marginRight:0; background-color:##7B8DA1;">

      <cfgrid name="contactList2" query="GetActivity" rowheaders="false" height="365" colheaderalign="center" colheaderfontsize="12" colheaderbold="yes" onchange="getUrl('act_view.cfm?ActivityID=' + contactList2.dataProvider[contactList2.selectedIndex]['ActivityID']);">
      <cfgridcolumn name="ActivityID" display="no">
      <cfgridcolumn name="Title" header="Activity Title" width="150">
      <cfgridcolumn name="Details" header="Details">
      <cfgridcolumn name="SiteArea" header="Site Area" width="70">
      <cfgridcolumn name="Mission" header="Mission" width="70">
      <cfgridcolumn name="Date" header="Activity Date" mask="mm/dd/yyyy" width="95">
      </cfgrid>

      <cfformgroup type="horizontal" height="14">

      <cfinput type="text" name="columns" visible="no" label="Check here to show columns:" width="0">
      <cfinput type="checkbox" name="chktitle" checked="true" label="Title" onClick="_global.setColumn(chktitle, {index:1, data:'title'})">

      <cfinput type="checkbox" name="chkdetails" checked="true" label="Details" onClick="_global.setColumn(chkdetails, {index:2, data:'details'})">

      <cfinput type="checkbox" name="chkSite" checked="false" label="SiteArea" onClick="_global.setColumn(chkSite, {index:3, data:'siteArea'})">
      <cfinput type="checkbox" name="chkMission" checked="false" label="Mission" onClick="_global.setColumn(chkMission, {index:4, data:'mission'})">
      <cfinput type="checkbox" name="chkDate" checked="true" label="Date" onClick="_global.setColumn(chkDate, {index:5, data:'Date'})">
      </cfformgroup>
      </cfform>