Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

CFGRID Search

New Here ,
Dec 17, 2009 Dec 17, 2009

I wrote a grid with the search at the top, this cfgrid is bringing the data from CFC. The problem is that grid is working perfect in IE7 but in higher IE I should push the compability button to make it works also it is not working in the firefox and safari. Any idea?

Appreciate your help.

This is the GRID code:

<script language="javascript" type="text/javascript">

function getTextSearchParam(){

return document.getElementById("text1").value;

}

function getOptionSearchParam(){

return document.getElementById("mydropdown").value;

}

function doSearchCustomer() {

ColdFusion.Grid.refresh('Students_grid', false);

}

</script>

<cfform name="FORM" method="post" action="access.cfm">

<table>

   <tr>

   <td > <input name="text1" type="text" id="text1"  size="45" /></td>

   <td>

   <select name="mydropdown">

   <option value="LastName">Last Name</option>

   </select>

   </td>

   <td>

   <cfinput type="button" name="search" id="search" value="Grid Search" size="45" maxlength="19"

   onClick="doSearchCustomer()" />

   </td>

   </tr>

   <tr><td colspan="3">

    <cfgrid  format="html" insert="yes" pagesize="10" name="Students_grid" selectmode="row"

    bind="cfc:grid.search({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection},

    getTextSearchParam(),getOptionSearchParam())">

                 <cfgridcolumn name="SID" width="150" header="Student ID">

                    <cfgridcolumn name="FirstName" width="150" header="First Name">                   

                    <cfgridcolumn name="LastName" width="200" header="Last Name">

                  </cfgrid>

   </td></tr>

  </table>

<form>

And this is CFC:

<cffunction name="search" access="remote" >

  <cfargument name="page" required="true" />

  <cfargument name="pageSize" required="true" />

  <cfargument name="gridsortcolumn" required="true" />

  <cfargument name="gridsortdirection" required="true" />

  <cfargument name="textSearch" required="true" />

  <cfargument name="optionSearch" required="true" />

  <cfif arguments.gridsortcolumn eq "">

    <cfset arguments.gridsortcolumn = "SID" />

    <cfset arguments.gridsortdirection = "asc" />

  </cfif>

    <cfquery name="search" datasource="Development">

            select       SID, DOB, FirstName, LastName, MI

            from        Students

                <cfif len(arguments.textSearch)>

               WHERE  #arguments.optionSearch# like '%#arguments.textSearch#%'

            </cfif>

            <cfif gridsortcolumn neq "" or gridsortdirection neq "">

                order by    #arguments.gridsortcolumn# #arguments.gridsortdirection#

            </cfif>

       </cfquery>

  <cfreturn queryconvertforgrid(search, page, pagesize) />

</cffunction>

898
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 20, 2009 Dec 20, 2009
LATEST

Do for a start:

<cfinput> in place of <input>

<cfselect> in place of <select>

</cfform> in place of <form>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources