Intro to ColdFusion Components Presentation

Tags: CFUG
Word Count: 85

I just want to thank everyone who came out last night and listened to me ramble for an hour and half. The presentation went great it seemed that everyone had a real interest in the subject and the turnout was really great. I would love to work on this preso more and maybe give it to another user group via connect so if your interested please drop me an email. If anyone has questions about the presentation material please let me know.

Comments

#1 Posted By: Chris Posted On: 11/14/08 9:00 AM
Just a suggestion, but you could always do it for the CFMeetup (http://www.meetup.com/coldfusionmeetup/)
#2 Posted By: Dan Vega Posted On: 11/14/08 9:03 AM |
Author Comment
I was actually going to ping Charlie. I am just not sure how many people would be interested
#3 Posted By: David Johnson Posted On: 11/14/08 4:53 PM
Thanks very much for the presentation last night. It was very informative and I am glad I came out. Will the example code be made available?
#4 Posted By: David Johnson Posted On: 11/14/08 4:57 PM
I wondered one other thing, I noticed in your eclipse install an icon that had MU on it. What plugin is that from, yo?
#5 Posted By: Wayne Pankey Posted On: 11/19/08 5:57 PM
Dan, have you seen this: I have a cfinput type=checkbox bound to a cfgrid via the grid's bind attribute. The checkbox is supposed to limit the returned recordset via it's value (on or off). Using the ColdFusion AJAX debugger, I see that the value of the checkbox is being passed to the cfc as "on" regardless of whether it is checked or not! Is this some sort of bug?
#6 Posted By: Wayne Pankey Posted On: 11/19/08 6:00 PM
Dan, have you seen this: I have a cfinput type=checkbox bound to a cfgrid via the grid's bind attribute. The checkbox is supposed to limit the returned recordset via it's value (on or off). Using the ColdFusion AJAX debugger, I see that the value of the checkbox is being passed to the cfc as "on" regardless of whether it is checked or not! Is this some sort of bug?
#7 Posted By: Dan Vega Posted On: 11/20/08 1:21 PM |
Author Comment
@David - MU - MxUnit plugin

@Wayne - I am not sure about that, have not played around with biding a whole lot.
#8 Posted By: Calvert Acklin Posted On: 11/25/08 11:31 PM
@Wayne

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..&nbsp;</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 Posted By: Calvert Acklin Posted On: 11/25/08 11:33 PM
@Wayne

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..&nbsp;</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>


Post Your Comment







Show Captcha

If you subscribe, any new posts to this thread will be sent to your email address.

Copyright © 2007 Dan Vega | BlogCFC was created by Raymond Camden. This blog is running version 5.8.001.