0 Replies Latest reply on Jan 29, 2009 8:01 AM by reya276

    Spry XML Filters

    reya276
      I need to filter a dataset using spry xml but I don't think I'm doing this correctly can anyone help me out with this.

      <script type="text/javascript">
      var ds1 = new Spry.Data.XMLDataSet("xmldata/hmo_summ_ra_xml.cfm?<cfoutput>st_date=#Session.st_date#&en_ date=#Session.en_date#&HMO_Name=#Session.HMO_Name#&Product_Label=#Session.Product_Label#&h mo=#url.hmo#</cfoutput>", "root/rowA");
      var ds2 = new Spry.Data.XMLDataSet("xmldata/hmo_summ_ra_xml.cfm?<cfoutput>st_date=#Session.st_date#&en_ date=#Session.en_date#&HMO_Name=#Session.HMO_Name#&Product_Label=#Session.Product_Label#&h mo=#url.hmo#</cfoutput>", "root/rowB");
      var pvPageRec = new Spry.Data.PagedView(ds1, { pageSize: 20 });
      var pvPageRecPagedInfo = pvPageRec.getPagingInfo();

      function dsFilter(ds, row, index){
      var critA = document.getElementById('critA').value;
      var critB = document.getElementById('critB').value;
      var critC = document.getElementById('critC').value;
      var c = row.critA.charAt(0); return c critC ? null : row;
      };
      function ToggleFilter(enable, f){
      if(enable)
      ds1.addFilter(f, true);
      else
      ds1.removeFilter(f, true);
      };
      </script>
      <cfform name="filterForm">
      <div id="filcomp">
      <span class="filtext">Filter by:</span>
      <cfselect name="critA" id="critA">
      <option value="activity_date" selected>Activity Date</option>
      <option value="payorcode">HMO</option>
      </cfselect>
      <span class="filtext">Criteria:</span>
      <cfselect name="critB" id="critB">
      <option value="=" selected>Equal</option>
      <option value=">">Greater Than</option>
      <option value="<" >Less Than</option>
      <option value=">=">Greater Than OR Equal</option>
      <option value="<=">Less Than OR Equal</option>
      </cfselect>
      <cfinput type="text" name="critC" id="critC" class="filinput" />
      <cfinput type="checkbox" name="dsFilter" value="f" checked="yes" disabled="yes">
      <cfinput type="button" name="filbt" value="Run Filter" class="filbutton" onclick="ToggleFilter(this.checked, dsFilter);" />
      </div>
      </cfform>
      I appreciate the help(I suck at javascript!), thanks.