Filtering records in a cfgrid using cfselect  and cfinput - calling the CFC when user clicks on a button

HumanScaleDev
HumanScaleDev used Ask the Experts™
on
Hello,

How can I prevent a cfselect from calling the CFC when filtering records in a cfgrid?  I'm  NOT using onchange in the cfselect. Every time the user selects a new value in the cfselect the CFC is called and the grid refreshes. Is there any way that this only happens when the user ONLY clicks on the button?

My code below:
<cfselect id="column" name="column" >
                        <option value=""></option>
                        <option value="ID">Ticket Number</option>
                        <option value="PO">PO Number</option>
                        <option value="salesOrderNo">SO Number</option>
                        </cfselect
<cfinput type="text" id="filter" name="filter" maxlength="20">
<cfinput type="button" name="search" value="Search" id="search" onclick="ColdFusion.Grid.refresh('files',false)" class="btn">

<cfgrid name="files"
                  format="html"
                  pageSize="15"
                  stripeRows = "yes"
            preservePageOnSort="true"
                  bind="cfc:getRecords.getRecords({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection}, {column},{filter})"
                  selectonload="false">      
       <cfgridcolumn name="ID" header="Ticket No." width="60" />
       <cfgridcolumn name="requestedOn" header="Requested On" width="150"/>
     <cfgridcolumn name="salesOrderNo" header="Sales Order No." width="100" />
       <cfgridcolumn name="assignto" header="Assigned to" width="80" />  
       <cfgridcolumn name="lastmodifiedOn" header="Last Modified on" width="161" />
     <cfgridcolumn name="status" header="Status" width="195" />        
    </cfgrid>

Thanks!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
Is it possible to add an onchange to the cfselect and tell it not to call the cfc or refresh the grid?

onchange="donothing" ... something like that.

thanks!
>> Is it possible to add an onchange to the cfselect and tell it not to call the cfc or refresh the grid?

if your cfgrid is bound to a cfselect, but you do not want the change in cfselect to trigger grid refresh, then set the binding with @none event key:

bind="blah.blah.blah({mycfselect@none}, {other-control-to-trigger-refresh})"

Azadi
PS:

using your code:

bind="cfc:getRecords.getRecords({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection}, {column@none},{filter@none})"

now neither cfselect nor the text input will trigger grid refresh.

Azadi
PPS:

hmm... i am not sure that, using the code i posted, clicking the 'search' button will pass the values of cfselect and text input to the binded cfc of the grid...

if it does not work, then use this one:

bind="cfc:getRecords.getRecords({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection}, {column@none},{filter@none},{search@click})"

{search@click} will trigger grid refresh on click of 'search' button. you should remove the onclick even from the button now.

Azadi

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial