Passing BIND values in CFGRID

2008-03-20 Thread RobG
I have a cfc that I wrote, with two methods.  The first method creates
a CFGRID, and the second method is called by the BIND attirbute in the
CFGRID to retrieve its data.

What I'm trying to do, basically, is pass a tablename and have a
generic CGRID appear that displays all of the columns in the table.
If the method I call from within the cfgrid's bind attribute is
specific to the table, it works fine.  But when I try to pass a
tablename and call a more generic method, it isn't working.  Here's
the code:

cfgrid  
bind=cfc:grid.getData({tablename},{cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection})

When I call the table-specific method, I don't pass {tablename} and
things work fine.  But then I added {tablename}, and in the getData
method, the value is coming through as NULL.  I tried changing it to
{#tablename#} and it still comes through as NULL, but the variable
becomes the name of the table instead of just tablename

So... what am I doing wrong?  How do I take a regular variable,
tablename in this case, and pass it through the BIND expression into
the cfc?  Is it possible?

Thanks!

Rob

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:301707
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Passing BIND values in CFGRID

2008-03-20 Thread Dan Vega
Is tablename an actual variable? What if you just passed it as a string
cfgrid  bind=cfc:grid.getData
(tablename,{cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection})

If thats not the issue, where is it failing?

On Thu, Mar 20, 2008 at 6:08 PM, RobG [EMAIL PROTECTED] wrote:

 I have a cfc that I wrote, with two methods.  The first method creates
 a CFGRID, and the second method is called by the BIND attirbute in the
 CFGRID to retrieve its data.

 What I'm trying to do, basically, is pass a tablename and have a
 generic CGRID appear that displays all of the columns in the table.
 If the method I call from within the cfgrid's bind attribute is
 specific to the table, it works fine.  But when I try to pass a
 tablename and call a more generic method, it isn't working.  Here's
 the code:

 cfgrid  bind=cfc:grid.getData
 ({tablename},{cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection})

 When I call the table-specific method, I don't pass {tablename} and
 things work fine.  But then I added {tablename}, and in the getData
 method, the value is coming through as NULL.  I tried changing it to
 {#tablename#} and it still comes through as NULL, but the variable
 becomes the name of the table instead of just tablename

 So... what am I doing wrong?  How do I take a regular variable,
 tablename in this case, and pass it through the BIND expression into
 the cfc?  Is it possible?

 Thanks!

 Rob

 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:301714
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Passing BIND values in CFGRID

2008-03-20 Thread Raymond Camden
When you bind a grid, you must pass the 4 required attributes
(gridpage, gridsize, gridsortcol, sortdir) and they must be first. So
if you want to pass _more_, you must put them _after_ the 4 required
attributes.

On Thu, Mar 20, 2008 at 3:08 PM, RobG [EMAIL PROTECTED] wrote:
 I have a cfc that I wrote, with two methods.  The first method creates
  a CFGRID, and the second method is called by the BIND attirbute in the
  CFGRID to retrieve its data.

  What I'm trying to do, basically, is pass a tablename and have a
  generic CGRID appear that displays all of the columns in the table.
  If the method I call from within the cfgrid's bind attribute is
  specific to the table, it works fine.  But when I try to pass a
  tablename and call a more generic method, it isn't working.  Here's
  the code:

-- 
===
Raymond Camden, Camden Media

Email : [EMAIL PROTECTED]
Blog : www.coldfusionjedi.com
AOL IM : cfjedimaster

Keep up to date with the community: http://www.coldfusionbloggers.org

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:301715
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Passing BIND values in CFGRID

2008-03-20 Thread Dan Vega
You sure about that Ray? I just ran this and it ran ok for me.

cfwindow initshow=true center=true
 width=430 height=340 title=Artists

cfform
   cfgrid name=artists format=html pagesize=10 striperows=yes
selectmode=edit delete=yes
bind=cfc:artists.getArtists
('one',{cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection})
onchange=cfc:artists.editArtist
({cfgridaction},{cfgridrow},{cfgridchanged})
  cfgridcolumn name=is display=false /
  cfgridcolumn name=lastname header=Last Name width=100/
  cfgridcolumn name=firstname header=First Name width=100/
  cfgridcolumn name=email header=E-Mail width=200/
   /cfgrid
/cfform

/cfwindow


 cffunction name=getArtists access=remote returntype=struct
  cfargument name=test type=string required=true
  cfargument name=page type=numeric required=yes
  cfargument name=pageSize type=numeric required=yes
  cfargument name=gridsortcolumn type=string required=no
default=
  cfargument name=gridsortdir type=string required=no default=

  !--- Local variables ---
  cfset var artists=

  !--- Get data ---
  cfquery name=artists datasource=cfartgallery
  SELECT artistid, lastname, firstname, email
  FROM artists
  cfif ARGUMENTS.gridsortcolumn NEQ 
 and ARGUMENTS.gridsortdir NEQ 
 ORDER BY #ARGUMENTS.gridsortcolumn# #ARGUMENTS.gridsortdir#
  /cfif
  /cfquery

  !--- And return it as a grid structure ---
  cfreturn QueryConvertForGrid(artists,
 ARGUMENTS.page,
 ARGUMENTS.pageSize)
   /cffunction


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:301717
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Passing BIND values in CFGRID

2008-03-20 Thread Raymond Camden
I coulda sworn - but if you say this works, I'm wrong. :)

On Thu, Mar 20, 2008 at 5:19 PM, Dan Vega [EMAIL PROTECTED] wrote:
 You sure about that Ray? I just ran this and it ran ok for me.

  cfwindow initshow=true center=true
  width=430 height=340 title=Artists

  cfform
cfgrid name=artists format=html pagesize=10 striperows=yes
  selectmode=edit delete=yes
 bind=cfc:artists.getArtists
  
 ('one',{cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection})
 onchange=cfc:artists.editArtist
  ({cfgridaction},{cfgridrow},{cfgridchanged})
   cfgridcolumn name=is display=false /
   cfgridcolumn name=lastname header=Last Name width=100/
   cfgridcolumn name=firstname header=First Name width=100/
   cfgridcolumn name=email header=E-Mail width=200/
/cfgrid
  /cfform

  /cfwindow


   cffunction name=getArtists access=remote returntype=struct
   cfargument name=test type=string required=true
   cfargument name=page type=numeric required=yes
   cfargument name=pageSize type=numeric required=yes
   cfargument name=gridsortcolumn type=string required=no
  default=
   cfargument name=gridsortdir type=string required=no default=

   !--- Local variables ---
   cfset var artists=

   !--- Get data ---
   cfquery name=artists datasource=cfartgallery
   SELECT artistid, lastname, firstname, email
   FROM artists
   cfif ARGUMENTS.gridsortcolumn NEQ 
  and ARGUMENTS.gridsortdir NEQ 
  ORDER BY #ARGUMENTS.gridsortcolumn# #ARGUMENTS.gridsortdir#
   /cfif
   /cfquery

   !--- And return it as a grid structure ---
   cfreturn QueryConvertForGrid(artists,
  ARGUMENTS.page,
  ARGUMENTS.pageSize)
/cffunction



  

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:301727
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4