<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:cc="http://web.resource.org/cc/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">
<channel>
<title>n42 Designs - Web Development</title>
<link>http://www.n42designs.com/blog/index.cfm</link>
<description>n42 Designs Blog</description>
<language>en-us</language>
<pubDate>Sun, 05 Sep 2010 05:07:10 -0400</pubDate>
<lastBuildDate>Wed, 12 Aug 2009 11:23:00 -0400</lastBuildDate>
<generator>BlogCFC</generator>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<managingEditor>sean@n42designs.com</managingEditor>
<webMaster>sean@n42designs.com</webMaster>
<itunes:subtitle></itunes:subtitle>
<itunes:summary></itunes:summary>
<itunes:category text="Technology" />
<itunes:category text="Technology">
<itunes:category text="Podcasting" />
</itunes:category>
<itunes:category text="Technology">
<itunes:category text="Tech News" />
</itunes:category>
<itunes:keywords></itunes:keywords>
<itunes:author></itunes:author>
<itunes:owner>
<itunes:email>sean@n42designs.com</itunes:email>
<itunes:name></itunes:name>
</itunes:owner>
<itunes:image href="" />
<image>
<url></url>
<title>n42 Designs</title>
<link>http://www.n42designs.com/blog/index.cfm</link>
</image>
<itunes:explicit>no</itunes:explicit>
<item>
<title>Filtering a CFGrid</title>
<link>http://www.n42designs.com/blog/index.cfm/2009/8/12/Filtering-a-CFGrid</link>
<description>
&lt;p&gt;So you
want to filter a CFGrid huh? ColdFusion makes this
easy!&lt;/p&gt;
&lt;p&gt;First you need a CFC method that will return the
query used to populate the grid. This method should take the cfgrid
parameters and the value you want to filter
on.&lt;/p&gt;
&lt;p&gt;data.cfc:&lt;/p&gt;
&lt;code&gt;
&lt;cfcomponent&gt;
&lt;cffunction name=&quot;getdata&quot; access=&quot;remote&quot; output=&quot;false&quot;
returntype=&quot;Any&quot;&gt;
&lt;cfargument name=&quot;page&quot;
required=&quot;false&quot; default=&quot;1&quot; type=&quot;Numeric&quot; /&gt;
&lt;cfargument name=&quot;pagesize&quot; required=&quot;false&quot; default=&quot;10&quot; type=&quot;Numeric&quot;
/&gt;
&lt;cfargument name=&quot;sortcolumn&quot; required=&quot;false&quot;
default=&quot;&quot; type=&quot;string&quot; /&gt;
&lt;cfargument name=&quot;sortdir&quot;
required=&quot;false&quot; default=&quot;ASC&quot; type=&quot;string&quot; /&gt;
&lt;cfargument name=&quot;filter&quot; required=&quot;false&quot; default=&quot;&quot; type=&quot;String&quot;
/&gt;&gt;
&lt;cfset q =
queryNew(&apos;id,name&apos;,&apos;integer,varchar&apos;) /&gt;
&lt;cfset queryaddrow(q,1) /&gt;
&lt;cfset querysetcell(q,&apos;id&apos;,1)
/&gt;
&lt;cfset querysetcell(q,&apos;name&apos;,&apos;sean&apos;) /&gt;
&lt;cfset queryaddrow(q,1) /&gt;
&lt;cfset
querysetcell(q,&apos;id&apos;,2) /&gt;
&lt;cfset
querysetcell(q,&apos;name&apos;,&apos;phillip&apos;) /&gt;
&lt;cfset queryaddrow(q,1) /&gt;
&lt;cfset querysetcell(q,&apos;id&apos;,3)
/&gt;
&lt;cfset querysetcell(q,&apos;name&apos;,&apos;steve&apos;) /&gt;
&lt;cfquery name=&quot;q&quot; dbtype=&quot;query&quot;&gt;
select * from q
&lt;cfif
len(trim(arguments.filter))&gt;
where name like &lt;cfqueryparam cfsqltype=&quot;cf_sql_varchar&quot;
value=&quot;%#arguments.filter#%&quot; /&gt;
&lt;/cfif&gt;
&lt;cfif
len(trim(arguments.sortcolumn)) or len(trim(arguments.sortdir))&gt;
order by #arguments.sortcolumn# #arguments.sortdir#
&lt;/cfif&gt;
&lt;/cfquery&gt;
&lt;cfreturn
queryConvertForGrid(q,arguments.page,arguments.pageSize) /&gt;
&lt;/cffunction&gt;
&lt;/cfcomponent&gt;
&lt;/code&gt;
&lt;p&gt;You can see here that I am just
hard coding the query in, you would replace this with your cfquery call
to your database or a call to your service layer, etc. Once you have
your query results, you want to use the queryConvertForGrid method to
format the result to a value that CFGrid can work
with.&lt;/p&gt;
&lt;p&gt;You then need a cfgrid! The trick here is how to
get the grid to refresh as the user types a value in the filter box.
ColdFusion Ajax UI tools have bind expressions that let us bind one
control to another, and to react to events.
&lt;/p&gt;
&lt;p&gt;index.cfm:&lt;/p&gt;
&lt;code&gt;
&lt;cfform&gt;
&lt;p&gt;&lt;label for=&quot;filter&quot;&gt;&lt;cfinput type=&quot;text&quot; name=&quot;filter&quot;
id=&quot;filter&quot; /&gt;&lt;/p&gt;
&lt;cfgrid format=&quot;html&quot;
bind=&quot;cfc:data.getData({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection},{filter@keyup})&quot;
name=&quot;grd&quot; bindonload=&quot;true&quot;&gt;
&lt;cfgridcolumn name=&quot;id&quot; /&gt;
&lt;cfgridcolumn name=&quot;name&quot; /&gt;
&lt;/cfgrid&gt;
&lt;/cfform&gt;
&lt;/code&gt;
&lt;p&gt;You can see my bind expression in the
cf grid. It will call the getData method of my data.cfc and pass in the
value from the &quot;filter&quot; input box whenever the key is released.
ColdFusion provides other events you can react to as well, check the
docs for details.&lt;/p&gt;
&lt;p&gt;So now if you run index.cfm you will see
a simple form with a text input and a grid. the grid will load when the
page is run (bindonload=&quot;true&quot;) and as you type in the text box, the
results are filtered.&lt;/p&gt;
&lt;p&gt;EDIT: removed the example link as I have moved this blog to &lt;a href=&quot;http://www.getrailo.org/&quot;&gt;Railo&lt;/a&gt;&lt;/p&gt;
</description>
<category>Web Development</category>
<category>ColdFusion</category>
<pubDate>Wed, 12 Aug 2009 11:23:00 -0400</pubDate>
<guid>http://www.n42designs.com/blog/index.cfm/2009/8/12/Filtering-a-CFGrid</guid>
</item>
<item>
<title>Webservices Change in CF
8.0.1</title>
<link>http://www.n42designs.com/blog/index.cfm/2008/4/17/Webservices-Change-in-CF-801</link>
<description>
It seems with the change to 8.0.1 there is a difference in the
way CF generates the stubs for a CFC called as a web service. I had a
CFC called webservices.cfc and on 8.0 it was working fine calling the
methods, but with the 8.0.1 it started throwing a &quot;duplicate file name&quot;
error. This seems to be because CF creates its own stub file
Webservices.java and also a [cfcname].java file. CF couldn&apos;t create
both so it threw an error. The solution was to rename my CFC. The
stubs can be found in C:\ColdFusion8\stubs\ on windows, and if I
remember correctly /Applications/ColdFusion8/stubs/ on Mac OS X.
</description>
<category>Web Development</category>
<category>ColdFusion</category>
<pubDate>Thu, 17 Apr 2008 06:50:00 -0400</pubDate>
<guid>http://www.n42designs.com/blog/index.cfm/2008/4/17/Webservices-Change-in-CF-801</guid>
</item>
<item>
<title>Issue w/ Eclipse Resource
Bundle Editor Plugin and Leopard</title>
<link>http://www.n42designs.com/blog/index.cfm/2008/1/17/Resource-Bundle-Editor-Plugin-and-Leopard</link>
<description>
There seems to be an issue with the
Resource Bundle Editor Plugin for Eclipse.
(http://sourceforge.net/projects/eclipse-rbe/)
I installed
version 0.7.7 into a fresh install of the Eclipse 3.3 SDK and was unable
to open a resource file. I would get the following
error:
&lt;code&gt;
Can&apos;t start the AWT because Java was started on
the first thread. Make sure StartOnFirstThread is not specified in your
application&apos;s Info.plist or on the command line
&lt;/code&gt;
To
fix it I edited the eclipse.ini file
(/Applications/eclipse/Eclipse.app/Contents/MacOS/eclipse.ini by
default) to add the following
line:
&lt;code&gt;
-Djava.awt.headless=true
&lt;/code&gt;
Once I
did that it was fine and I was able to edit the resource
bundles.
Hope this helps someone searching for the issue!
</description>
<category>Eclipse</category>
<category>Web Development</category>
<pubDate>Thu, 17 Jan 2008 18:18:00 -0400</pubDate>
<guid>http://www.n42designs.com/blog/index.cfm/2008/1/17/Resource-Bundle-Editor-Plugin-and-Leopard</guid>
</item>
</channel></rss>