jQuery Select Example
johnny said: oh, great. I help me a lot. Thanks!!!
[More]
Multiple File Uploads in ColdFusion
Robert N. said: Hi,
I'd like to be able to upload multiple files as part of a form submission. Is this possible wi...
[More]
Coldbox datasource setting and Wirebox
Bummed Out said: Just starting out with ColdBox 3.1.0 and ready to give up because I can't access my data source sett...
[More]
CFGrid Event Listeners
steve said: I was wondering if there was an event to handle the refreshing of new data either from the initial l...
[More]
Getting the public IP address of a visitor
Ken Hughes said: Could you use the accept-language browser header? If it's en-US, treat them as in the USA, otherwise...
[More]
#1 by Chris on 11/14/08 - 9:00 AM
#2 by Dan Vega on 11/14/08 - 9:03 AM
#3 by David Johnson on 11/14/08 - 4:53 PM
#4 by David Johnson on 11/14/08 - 4:57 PM
#5 by Wayne Pankey on 11/19/08 - 5:57 PM
#6 by Wayne Pankey on 11/19/08 - 6:00 PM
#7 by Dan Vega on 11/20/08 - 1:21 PM
@Wayne - I am not sure about that, have not played around with biding a whole lot.
#8 by Calvert Acklin on 11/25/08 - 11:31 PM
Here's an example that accomplishes a similar result using the Derby artgallery database that ships with CF 8:
CF:
<cfajaximport />
<html>
<head>
<script type="text/javascript">
function init() {
//get the gridArtists component
gridArtists = ColdFusion.Grid.getGridObject("gridArtists");
gridArtistsView = gridArtists.getView();
var cm = gridArtists.getColumnModel();
var gridFoot = gridArtists.getView().getFooterPanel(true);
var ds = gridArtists.getDataSource();
// add a paging toolbar to the grid's footer
var paging = new Ext.PagingToolbar(gridFoot, ds, {
pageSize: 500,
displayInfo: true,
displayMsg: 'Displaying records {0} - {1} of {2}',
emptyMsg: "No records to display"
});
}
</script>
</head>
<body>
<strong>Example CFGrid with Checkbox as Filter</strong>
<br>
<cfform name= "artistForm1">
<cfgrid format="html" name="gridArtists" pagesize="500" selectmode="row" selectOnLoad="false" bindOnLoad="true" height="200" appendkey="yes" sort="true" bind="cfc:Artists.getArtistsByState({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection},{artistForm1:thisCheckboxForGrid.value})" >
<cfgridcolumn name="artistid" header="No." width="30">
<cfgridcolumn name="firstname" header="First Name">
<cfgridcolumn name="lastname" header="Last Name">
<cfgridcolumn name="email" header="Email Address">
<cfgridcolumn name="address" header="Address">
<cfgridcolumn name="city" header="City">
<cfgridcolumn name="state" header="State">
<cfgridcolumn name="postalcode" header="Zip">
</cfgrid>
<br><br>
<div id="lowerFieldset" style=" margin-bottom:15px;">
<fieldset style="width:500px;">
<legend>Select the Checkbox to filter grid.. </legend>
<span class="body-text" style="font-weight:bold; padding-left:30px;">
<cfinput class="body-text" type="checkbox" name="thisCheckboxForGrid" value="CO" checked="yes" />
<span style="padding-left:3px;">Option 1 (CO)</span>
</span>
<span class="body-text" style="font-weight:bold; padding-left:30px;">
<cfinput class="body-text" type="checkbox" name="thisCheckboxForGrid" value="DC" />
<span style="padding-left:3px;">Option 2 (DC)</span>
</span>
</fieldset>
</div>
</cfform>
<cfset ajaxOnLoad("init")>
</body>
</html>
CFC:
<cffunction name="getArtistsByState" access="remote" output="false">
<cfargument name="page">
<cfargument name="pageSize">
<cfargument name="gridsortcolumn">
<cfargument name="gridsortdirection">
<cfargument name="state" default="">
<cfset var qryArtists="">
<cfquery name="qryArtists" datasource="cfartgallery">
SELECT
artistId,
firstname,
lastname,
address,
city,
state,
postalcode,
email
FROM Artists
<cfif Arguments.state neq "">
WHERE state IN (<cfqueryparam list="yes" separator="," value="#Arguments.state#" >)
</cfif>
<cfif gridsortcolumn neq "" or gridsortdirection neq "">
ORDER BY #gridsortcolumn# #gridsortdirection#
</cfif>
</cfquery>
<cfcontent reset="yes">
<cfreturn QueryConvertForGrid(qryArtists, page, min(arguments.pageSize, qryArtists.recordCount)) >
</cffunction>
#9 by Calvert Acklin on 11/25/08 - 11:33 PM
Here's an example that accomplishes a similar result using the Derby artgallery database that ships with CF 8:
CF:
<cfajaximport />
<html>
<head>
<script type="text/javascript">
function init() {
//get the gridArtists component
gridArtists = ColdFusion.Grid.getGridObject("gridArtists");
gridArtistsView = gridArtists.getView();
var cm = gridArtists.getColumnModel();
var gridFoot = gridArtists.getView().getFooterPanel(true);
var ds = gridArtists.getDataSource();
// add a paging toolbar to the grid's footer
var paging = new Ext.PagingToolbar(gridFoot, ds, {
pageSize: 500,
displayInfo: true,
displayMsg: 'Displaying records {0} - {1} of {2}',
emptyMsg: "No records to display"
});
}
</script>
</head>
<body>
<strong>Example CFGrid with Checkbox as Filter</strong>
<br>
<cfform name= "artistForm1">
<cfgrid format="html" name="gridArtists" pagesize="500" selectmode="row" selectOnLoad="false" bindOnLoad="true" height="200" appendkey="yes" sort="true" bind="cfc:Artists.getArtistsByState({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection},{artistForm1:thisCheckboxForGrid.value})" >
<cfgridcolumn name="artistid" header="No." width="30">
<cfgridcolumn name="firstname" header="First Name">
<cfgridcolumn name="lastname" header="Last Name">
<cfgridcolumn name="email" header="Email Address">
<cfgridcolumn name="address" header="Address">
<cfgridcolumn name="city" header="City">
<cfgridcolumn name="state" header="State">
<cfgridcolumn name="postalcode" header="Zip">
</cfgrid>
<br><br>
<div id="lowerFieldset" style=" margin-bottom:15px;">
<fieldset style="width:500px;">
<legend>Select the Checkbox to filter grid.. </legend>
<span class="body-text" style="font-weight:bold; padding-left:30px;">
<cfinput class="body-text" type="checkbox" name="thisCheckboxForGrid" value="CO" checked="yes" />
<span style="padding-left:3px;">Option 1 (CO)</span>
</span>
<span class="body-text" style="font-weight:bold; padding-left:30px;">
<cfinput class="body-text" type="checkbox" name="thisCheckboxForGrid" value="DC" />
<span style="padding-left:3px;">Option 2 (DC)</span>
</span>
</fieldset>
</div>
</cfform>
<cfset ajaxOnLoad("init")>
</body>
</html>
CFC:
<cffunction name="getArtistsByState" access="remote" output="false">
<cfargument name="page">
<cfargument name="pageSize">
<cfargument name="gridsortcolumn">
<cfargument name="gridsortdirection">
<cfargument name="state" default="">
<cfset var qryArtists="">
<cfquery name="qryArtists" datasource="cfartgallery">
SELECT artistId, firstname, lastname,
address, city, state, postalcode,
email
FROM Artists
<cfif Arguments.state neq "">
WHERE state IN (<cfqueryparam list="yes" separator="," value="#Arguments.state#" >)
</cfif>
<cfif gridsortcolumn neq "" or gridsortdirection neq "">
ORDER BY #gridsortcolumn# #gridsortdirection#
</cfif>
</cfquery>
<cfcontent reset="yes">
<cfreturn QueryConvertForGrid(qryArtists, page, min(arguments.pageSize, qryArtists.recordCount)) >
</cffunction>