Using labelFunction to format cfgrid columns
If you ever used cfgrid, you know that it accepts a query as its data. Each cfgridcolumn of the grid has to be a column of the query. You cannot combine two or more columns or add something to the column. That means that any formatting of the data needs to be done before giving the query to the grid (unless you loop over it and use
Most likely, you would do this in sql, by creating a new column that is a combination of other columns or by adding strings to a given column. The same problem arises if you wanted to format the data using something different than the provided types (currency for example) and the mask attribute is known to be unpredictable sometimes. The requirement of having to provide only a column, and nothing else, to the
So let me explain how to do data formatting on the client as opposed as in the query. We will use the onload function available in the 7.01 updater to change the "labelFunction" of the column we want to format. In this example, we will use three different columns to show an address in one column. This can also be used in combination with variableRowHeight, as shown in the second example, to have a multiple-line row (you can also set the height of the rows if it is fixed).
Note that the query columns are: id, address, city, state
<cfform name="myform" format="Flash" onload="formOnLoad()">
<cfformitem type="script">
function formOnLoad(){
<!--- get the first column and tell it to use setLabel as its label function
starts at 1 because first column is CFGRIDROWINDEX
if yours is not the first column, then just count the index--->
myGrid.getColumnAt(1).labelFunction = setLabel;
}
<!--- function that gets called when cells are rendered --->
function setLabel(item:Object, columnName:String): String {
<!--- because we are using this function on only one column, we don't really
need to use the columnName parameter, but we would need it if
used the same function for several columns and wanted to know which column
we are supposed to format --->
<!--- you can use item.address or item['address'] --->
return item.address + ', ' + item.city + ', ' + item.state;
};
</cfformitem>
<cfgrid name="myGrid" query="properties">
<cfgridcolumn header="Address" name="address">
</cfgrid>
</cfform>
Example with multiple lines (adding "/n") and having variableRowHeight = true
<cfformitem type="script">
function formOnLoad(){
<!--- make the grid rows multiline --->
myGrid.variableRowHeight = true;
myGrid.getColumnAt(1).labelFunction = setLabel;
<!--- if the data in this column is long and you want it to wrap --->
myGrid.getColumnAt(1).wordWrap = true;
}
<!--- function that gets called when cells are rendered --->
function setLabel(item:Object, columnName:String): String {
<!--- insert a new line between the address and the city --->
return item.address + '\n' + item.city + ', ' + item.state;
};
</cfformitem>
Suppose your database contain the filename of the image you want to show in the grid using
<cfform name="myform" format="Flash" onload="formOnLoad()">
<cfformitem type="script">
function formOnLoad(){
myGrid.getColumnAt(1).labelFunction = setLabel;
}
<!--- function that gets called when cells are rendered --->
function setLabel(item:Object, columnName:String): String {
if ( item[columnName] != undefined) {
<!--- add the path to the item to that it knows where to find the picture, you can either use absolute or relative paths: /path/to/my/images --->
return "images/" + item[columnName];
}
else {
return "";
}
};
</cfformitem>
<cfgrid name="myGrid" rowHeight="50" rowheaders="false" query="properties">
<cfgridcolumn type="image" width="75" name="thumbnail" header="Photo">
<cfgridcolumn name="city" header="City">
</cfgrid>
</cfform>
From what I've seen so far since I've started using this technique, it has the nice effect of fixing the "mysteriously disappearing image" bug experienced in Firefox when using
You can use this technique to implement formatting other than the built-in types (I just couldn't think of a quick example). You can also do the same with cfselect, but you won't have all the query columns available unless you loaded the data via remoting, so you'll have label and data as the only sources.
William
Also the fix for the Firefox bug is exactly what I needed!
Thanks so much
todd
For example, if you have a column with both text and dates and apply type=date cf magically removes all the non-dates from the col.
I wonder if you change the type to date after load it would leave the non-dates in the col.
felipe
I tried set the width and heigth of the collumn but it still cropping the image.
Neil Bailey
Thanks for all the help and great work.
neil
Neil Bailey
Laura
I don't think you can change the type on the fly.
felipe,
using rowHeight="some number" in cfgrid and width="some number" in cfgricolumn should work fine.
Felipe
Neil Bailey
I set the rowHeight to 50, and now I want any data that doesn't need multiple lines to be top aligned. Any suggestions?
Laura
As you know, showing images in the grid is quite buggy. It works for me for pictures coming from certain hosts, but not others. It's just weird. Without looking at the image renderer source of cfform, I can't tell exactly what the problem is, or might even be a Flash bug.
Neil,
Use myGrid.verticalAlign = "top"; in the onload function.
Jorge Tejada
Laura
We did nothing, it just worked. Perhaps something got misconfigured. I would check that remoting is working.
WayneG
Please find the code I have finally managed to get working to loop over specific gros rows columns that I want froma grid that has 6 columns. Is this the correct way.
function confirmClick():Void{
var timesheetConfirmation:mx.controls.DataGrid = timesheetConfirmation;
var args:Array = [];
for(var i:Number = 0; i < timesheetConfirmation.length; i++){
var item:Array = [];
item.intTimesheetID = timesheetConfirmation.dataProvider[i].intTimesheetID;
item.bitIsCaptured = timesheetConfirmation.dataProvider[i].bitIsCaptured;
item.bitIsConfirmed = timesheetConfirmation.dataProvider[i].bitIsConfirmed;
item.intLogUser = intLogUser.text;
args.push(item);
}
_global.confirmation(args);
}
the args then go to via facade.cfm to cfc which is then giving me the following error:
You have attempted to dereference a scalar variable of type class java.util.ArrayList as a structure with members.
I am looping the cffunction, with a cfargument set as type="array" name="args"
This is where I need help please.. I cant get the function to update the records of the array..Pleaseeeee
Joshua Buttler
I am a very newbie to Actionscript so please bear with me. :)
In regards to the above mentioned use of "{(myGrid.selectedItem != undefined)myGrid.selectedItem.myColumn:'any default'}" to not have an "undefined" showing, how exactly is that used and I assume I use it on the actual "bind" atribute of the cfformitem?
Sorry for being so thick-headed and thanks for your help.
:)
Joshua Buttler
http://www.asfusion.com/blog/entry/using-labelfunction-to-format-cfgrid
Wrong post...I have too many tabs open. :)
Laura
That indicates you have a problem with your cfm code in the cfc. Your ActionScript seems ok (except for _global.confirmation(args);, which is a little strange). I would use getItemAt() instead of accessing the dataProvider directly.
Joshua,
That goes in the bind attribute of an input, textarea, etc. Don't forget the question mark after (myGrid.selectedItem != undefined)
WayneG
Thank you so much for your reply,..know u very busy.If I replace the datprovider with item.intTimesheetID = timesheetConfirmation.dataProvider[i].intTimesheetID; then the values in the grid are not passsed, only the array column names.
I pass the args as an array to a cfc. With the cfargument set as type="array". When I try loop over the array to update the database I get the error in my previous post.
My question: how do I script the cf code. Is the array coming from actionscript is starting at [0], so CF doent reconize the array type as a cf array starts at [1]?
Thanks again !
WayneG
My sincere apologies, thank you for the advice getItemAt() works perfectly! Please don have a look at my question that I have posted adbove.
Just been curious, why is it not a good idea to use the dataProvider versus the getItemAt()?
You examples have been a tremendous help, thank again
Javier Julio
Steven Ross
for instance we have a grid with the column "NewsletterID" but no "NewletterName" because the name of the newsletter is in another table.
two queries are executed on the page one that populates the grid and another that is used to generate a dropdown box. When I select an item in a grid i want to pass the id of the newsletter to the select box which will select the item in it that has the matching ID.
Can this be done?
Laura
You need to add wordWrap to every column:
myGrid.getColumnAt(1).wordWrap = true;
I added to the post example.
Steven,
Is something like the "state" dropdown in this example what you want? (the grid has only the state id, while the dropdown has id as value and name as display label)
http://www.asfusion.com/apps/realestate/
Javier Julio
Steven Ross
Scott
Laura
First week of December :)
Scott,
not elegant, but you will need to have a break in the header:
<cfgridcolumn header="Line 1
line 2" name="address">
then you will need to make the header taller. Add this to the formOnLoad() function
myGrid.headerHeight = 50;//or whatever height you want in pixels
Scott
Javier Julio
Laura
The easiest way is to separate the label from the field. Look at the search panel in the Real Estate Sample app for example on how to do it.
Chaz
you answer a question from Scott about displaying two line header, after I did this how can I align the text?
Sami Hoda
DerekB
What I REALLY want is to get how many rows are in the grid, and to be able to easily get a cell's value at a particular row.
Even more specifically, something like what is going on in the excellent Real Estate tutorial (http://www.asfusion.com/blog/entry/coldfusion-flash-forms-macromedia-2 )
around about the
<cfinput type="text" name="edit_city"
bind="{(listingGrid.selectedItem!=undefined)?listingGrid.selected
Item.city:''}" label="city" />
But instead of selectedItem, I just want the City value for row 1.
Much appreciated!
KenM
It seems that I should be able to use this same general idea (the onLoad function) to format a number value in a grid cell? I have a column like "income" and a column like "spent." If spent is greater than income I'd like the number to be red. Any ideas how to go about this, using just a query instead of a loop?
Thx
Dan
Nice example. I not sure if this is a bug or not.
I added a binding to get the value of the selected address... and found it returns the original data, not the formatted data as one might expect.
<cfinput type="text" name="edit_Address" bind="{(myGrid.selectedItem!=undefined)?myGrid.selectedItem.address:''}" label="address" />
Example Code:
<cfscript>
properties = queryNew("id,thumbnail,city,address,state");
queryAddRow(properties);
querySetCell(properties,'id','1');
querySetCell(properties,'thumbnail','house1Thum.jpg');
querySetCell(properties,'city','Arrowhead');
querySetCell(properties,'address','8734 Maple Rd');
querySetCell(properties,'state','CA');
queryAddRow(properties);
querySetCell(properties,'id','2');
querySetCell(properties,'thumbnail','house2Thum.jpg');
querySetCell(properties,'city','Big Bear Lake');
querySetCell(properties,'address','7687 Apple St');
querySetCell(properties,'state','CA');
queryAddRow(properties);
querySetCell(properties,'id','3');
querySetCell(properties,'thumbnail','house3Thum.jpg');
querySetCell(properties,'city','Los Angeles');
querySetCell(properties,'address','21242 Wilshire Blvd');
querySetCell(properties,'state','CA');
queryAddRow(properties);
querySetCell(properties,'id','4');
querySetCell(properties,'thumbnail','house4Thum.jpg');
querySetCell(properties,'city','Berverly Hills');
querySetCell(properties,'address','2384 Rodeo Drive');
querySetCell(properties,'state','CA');
</cfscript>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html style="margin:0; height:100%;">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Showing data from 3 columns in one</title>
</head>
<cfform name="myform" height="300" width="600" format="Flash" timeout="100" onload="formOnLoad()">
<cfformitem type="script">
function formOnLoad(){
<!--- make the grid rows multiline --->
myGrid.variableRowHeight = true;
myGrid.getColumnAt(1).labelFunction = setThumb;
<!--- get the first column and tell it to use setLabel as its label function
starts at 1 because first column is CFGRIDROWINDEX --->
myGrid.getColumnAt(2).labelFunction = setLabel;
<!--- if the data in this column is long and you want it to wrap --->
myGrid.getColumnAt(2).wordWrap = true;
myGrid.verticalAlign = "top";
}
<!--- function that gets called when cells are rendered --->
function setLabel(item:Object, columnName:String): String {
<!--- because we are using this function on only one column, we don't really
need to use the columnName parameter, but we would need it if
used the same function for several columns and wanted to know which column
we are supposed to format --->
<!--- insert a new line between the address and the city --->
return item.address + '\n' + item.city + ', ' + item.state;
};
<!--- function that gets called when cells are rendered --->
function setThumb(item:Object, columnName:String): String {
<!--- because we are using this function on only one column, we don't really
need to use the columnName parameter, but we would need it if
used the same function for several columns and wanted to know which column
we are supposed to format --->
if ( item[columnName] != undefined) {
<!--- add the path to the item to that it knows where to find the picture --->
return "images/" + item[columnName];
}
else {
return "";
}
};
</cfformitem>
<cfgrid name="myGrid" rowHeight="50" rowheaders="false" query="properties" width="350" height="200">
<cfgridcolumn type="image" width="75" name="thumbnail" header="Photo">
<cfgridcolumn header="Address" name="address">
<cfgridcolumn name="city" header="City">
</cfgrid>
<cfinput type="text" name="edit_city" bind="{(myGrid.selectedItem!=undefined)?myGrid.selectedItem.city:''}" label="city" />
<cfinput type="text" name="edit_Address" bind="{(myGrid.selectedItem!=undefined)?myGrid.selectedItem.address:''}" label="address" />
</cfform>
Dan
A little hacking and I found the "fix" for the previous bug.
You need to call the setLabel function a second time when you "render" the cf input.
Change
<cfinput type="text" name="edit_myColumn" bind="{(myGrid.selectedItem!=undefined)?myGrid.selectedItem.address:''}" label="address" />
to
<cfinput type="text" name="edit_Address" bind="{(myGrid.selectedItem!=undefined)?setLabel(myGrid.selectedItem):''}" label="address" />
You'll also need to call the method directly without the address attribute:
setLabel(myGrid.selectedItem)
Lesson learned here:
The underlaying data stored in the grid does NOT change when a cell is rendered, only the display of the "renderered" the cell.
Makes total sense when you think about it, but I'm sure there's others out there that made the assumption that the data binding would have been pointing to the rendered data vs the original data.
Daveline
Alex
Could somebody please show me how to wordWrap on the Column Header...
Thanks
GKilla
Based on what I've read so far, it seems the only way to embed am image within a cfgrid is by pulling image URL info from a database. My question is can this be done without referring to a database at all and just include the path info to the image directory location?
I am running into some difficulty where I would like to notify the user of the state of his/her item - i.e. an item that is flagged as "New", "Requires Attention" or "Overdue" based on the timestamp.
Essentially, I am displaying a user's work queue in a grid and need to implement the aforementioned "flag" feature using images to indicate the current state. Ideally, I would like the image to display in a separate column by itself, but that is impossible since the header column must use an existing db table. I guess this leads to another question: can an image be placed into the same cell with actual data?
Any suggestions or ideas are greatly appreciated.
Laura
What you write in the setLabel function is up to you. You don't have to make reference to a column that contains an image filename only, you can make it up as in:
if (item['status'] == 'New')
return "images/newImage.jpg";
else
return "images/overdueImage.jpg";
Don't copy the code as is :) it's just an example. You might want to use a switch, change your column names, compare it with the date or whatever. If you look at the other example that concatenates several columns can give you ideas of what to do. By the way, you can always manipulate a query before sending it to a grid to add whatever columns or values you want (meaning values and columns do not have to come straight from the database)
GKilla
The following code is from the non-flash form version that I'm trying to emulate.
----------Initial queries ---------
<cfquery datasource="#application.defaultdsn#" name="getDiscussionIDs">
SELECT Distinct discussionID
FROM discussionPosts
WHERE discussionPosts.userID = #session.tutorID# OR discussionPosts.viewerID = #session.tutorID#
</cfquery>
<cfquery datasource="#application.defaultdsn#" name="qQuestions">
SELECT discussions.dateSubmitted, discussions.discussionID, discussions.subjectID, discussions.topic, users.firstName + ' ' + users.lastName AS stName, subjects.subjectID, subjects.subject
FROM discussions INNER JOIN users ON discussions.userID = users.userid INNER JOIN subjects ON discussions.subjectID = subjects.subjectID
WHERE 0=0
<cfif getDiscussionIDs.recordCount GT 0>
AND (
<cfloop query="getDiscussionIDs">
discussions.discussionID = #getDiscussionIDs.discussionID# <cfif getDiscussionIDs.currentRow NEQ getDiscussionIDs.recordCount>OR</cfif>
</cfloop>
)
<cfelse>
AND 0=1
</cfif>
</cfquery>
============ Queries used to determine status ============
<cfoutput query="qQuestions">
<cfquery datasource="#application.defaultdsn#" name="LatestMessage">
SELECT Max(discussionPosts.postID) AS NewestMessage
FROM discussionPosts
WHERE discussionPosts.discussionID = #discussionID#
</cfquery>
<cfset variables.userTypetoView = "tutor">
<!--- <cfif LatestMessage.recordCount --->
<cfquery datasource="#application.defaultdsn#" name="getLastInfo">
SELECT discussionPosts.userType, discussionPosts.dateSubmitted, discussionPosts.viewerID
FROM discussionPosts
WHERE discussionPosts.postID = #LatestMessage.NewestMessage#
</cfquery>
<cfif currentrow mod 2>
<tr>
<cfelse>
<tr class="bodybkgd">
</cfif>
<td align="center" valign="top">
<cfif getLastInfo.recordCount GT 0 AND Trim(getLastInfo.userType) EQ "tutor">
<img src="images/opts_16.gif" alt="Archived Item" border="0" align="">
<cfelseif getLastInfo.viewerID EQ session.tutorID>
<img src="images/redo_116.gif" alt="Waiting for your Response" border="0" align="">
<cfelse>
<img src="images/favs_16.gif" alt="New Question!" border="0" align="">
</cfif>
Laura
My response is still valid. If you look carefully, the image does not come from the database. You can make it up however you want, you just need to think a little harder ;)
If you need data from other places, you will need to have them available, be it in a datagrid, in a hidden input, I don't know, it depends on what other data you require.
GKilla
Ideally, if I nested the 2 other queries (that determine the status) within the grid and used one of the problems as a filter in my WHERE clause, then this problem could be resolved. Unfortunately, this is just not working out for me :(
Joshua Scott
How do I access this?
I have:
<cfinput type="hidden" name="httpPath" value="#httpPath#">A
AND
return #httpPath# + "model/FileExplorer/icons/" + item[columnName] + ".jpg";
But I am getting an error. How do I access this variable.
What am I doing wrong?
Laura
In ActionScript, you can only access ActionScript variables. You can do some stuff by using ##, but that almost always makes your form recompile. (Your example above would give a syntax error as is because it is missing quotes.)
Hidden fields are accessible by myFormName.myHiddenField. So in your example, it would be something like:
return YouFormName.httpPath + "model/FileExplorer/icons/" + item[columnName] + ".jpg";
Joshua
I have a interesting question for you guys pertaining the CFgrid. Have any of you tried to make some columns editable, while making other columns just browseable?
For example:
Column1 Column 2 Column 3
Editable NotEditable NotEditable
Laura
That is specified in the CF Docs. You need to set the columns that you don't want to be editable as select="false"
<cfgrid name="myGrid" selectmode="edit" query="myQuery">
<cfgridcolumn name="Column1">
<cfgridcolumn name="Column2" select="false">
<cfgridcolumn name="Column3" select="false">
</cfgrid>
Joshua
Jeff
Second: Any way of controling the cfgrid so that I can word wrap the column headers with out going into flash and creating a new renderer?
Laura
Thanks!
See my reply in comment 24: http://www.asfusion.com/blog/entry/using-labelfunction-to-format-cfgrid#comment-1797
Jeff
~J
Guillermo
I added the CFIDE as a virtual directory and still nothing.
Any ideas?
I have CF7.02 on Windows 2000 server
Laura
See my reply here: http://www.asfusion.com/blog/entry/more-quick-bindings#comment-552
Chris
<cfgridcolumn type="image" width="75" name="thumbnail" header="Photo">
Thanks in advance!
Chris
Thanks anyway!
I used:
dG.getColumnAt(x).labelFunction=_root.setLabel;
dG.getColumnAt(x).cellRenderer="imageCellRenderer";
Boybles Maldooney
Thanks!
Boybles
R. Williams
Boybles Maldooney
http://cfsilence.com/blog/client/index.cfm/2006/6/12/CFGRID-Cell-Renderer--ComboBox-Select
and another one off of Phillipe Maegerman's AWESOME blog:
http://cfpim.blogspot.com/2005/08/grid-cellrenderer-in-flash-forms.html
I hope this community continues to work with cfform as it does with Flex. Not all of us are ready to make the leap.
Scott
if (item.real_video_available = 'Y') {
<!--- add the path to the item to that it knows where to find the picture --->
return "../../images/VideoThumbs/" + item[columnName] + ".jpg";
<!--- return item.real_video_available --->
}
else {
return "../../images/AudioOnly.jpg";
}
This above only does logic on the first row collected... so the Else part of this function never happens.
Laura
I think your problem is not that only the first row gets evaluated but rather that the if statement will always give true since you are using "=" instead of "=="
The expression should be:
tem.real_video_available == 'Y'
Fernando
For example, if I have a column with checkboxes, and I want some of them to be "selectable" and others not depending on a value of the current record being rendered.
Laura
I don't think you can easily do that because the grid uses two different cell renderers for editable/not editable columns (for the checkboxes), and the cell renderers apply to the whole column. The same happens with the editable property (for simple text columns), it applies to the whole column.
Gary
textcolor = "(CX LT 4 ? black : blue)"
where CX references the current grid column, and if the value in that cell is less than 4, the text color is rendered as black, otherwise it is rendered as blue.
Sounds good. But when I've tried to apply this code, the cfform (format = "flash") fails to appear. Any one spot what is wrong? Driving me nuts.
Maggie
Laura
That code only works for the Java version of the datagrid. I don't think there is a way to change the color of only one row and one cell. I know for sure you can change the color of the row background with something like this:
myGrid.setPropertiesAt(someIndexNumber, {backgroundColor:0xF7FFB7});
as it is shown in this post http://www.asfusion.com/blog/entry/looping-over-the-records-of-a-large-cfgrid or change the color of the whole column.
But I could be wrong, so I would check the Flex 1.5 docs for more info on that.
Cesar Mejia
Jeremie
I tested and adapted your code a little bit. I could display a jpg file but png and gif won't work. Is there a solution? Any ideas?
Thanx a lot!!
Cesar Mejia
Brian
Brian
drew
TIA. --Drew
Jeff
<cfscript>
getphoto = queryNew("id,thumbnail");
queryAddRow(getphoto);
querySetCell(getphoto,'id','1');
querySetCell(getphoto,'thumbnail','#source#');
</cfscript>
<cfformitem type="script">
function formOnLoad(){
detail2.headerHeight = 50;
<!---Get the first column and tell it to use setLabel as its labelFunction. Starts at 1 because first column is CFGRIDROWINDEX--->
photogrid.getColumnAt(1).labelFunction = setLabel;
}
function setLabel() {
return "images/idbadge/broal.jpg";
}
;
</cfformitem>
<cfgrid name="photogrid" format="applet" colheaders="no" rowheaders="no" width="100" height="100" query="getphoto">
<cfgridcolumn name="thumbnail" type="image" header="Photo">
</cfgrid>
I would appreciate any further assistance. Thank you.
Jeff
max
Maggie
I am having a really strange error - any help would be greatly appreciated. I have the labelFunction and the wordWrap working just fine - until there is a large amount of text that causes the vertical scrollbars to appear in the cfgrid. When you attempt to scroll down, all the text slides off and disappears to the right. Has anyone else encountered this? It is happening in both FireFox and IE. Here is what I am using:
var dgList = dgList;
dgList.getColumnAt(1).wordWrap = true;
dgList.getColumnAt(1).labelFunction = setPSLabel;
dgList.getColumnAt(2).labelFunction = setISLabel;
dgList.getColumnAt(2).wordWrap = true;
dgList.getColumnAt(3).wordWrap = true;
dgList.getColumnAt(4).wordWrap = true;
Again - everything shows up fine, until the word wrapping is in effect, and it wraps enough to display the scroll bars in the data grid.
Mossy
Laura
To use the type "script" you need to have the ColdFusion updater. If I remember correctly, updater 1 should work.
samantha
samantha
mp
David Repas
Anyone else having this issue? Any fixes?
Thanks.
David Repas
The disappearing issue is solved with the above fix, but "jumping" images is not. This only occurs in Firefox, not IE.
Any help?
David Repas
The disappearing issue is solved with the above fix, but "jumping" images is not. This only occurs in Firefox, not IE.
Any help?
ddidci
I have problem. This labelfunction doesn't wish to work correct for me. It works but only if i use your sample here, and i need to do some changes.
I will so much appreciate if you can help me.
Here is my code:
<cfquery name="SelectQry" dbtype="query" datasource="#Application.DSN#">
Select rank, firstname
From Persons
</cfquery>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html style="margin:0; height:100%;">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Showing data from 3 columns in one</title>
</head>
<cfform name="myform" height="300" width="600" format="Flash" timeout="100" onload="formOnLoad()">
<cfformitem type="script">
function formOnLoad(){
myGrid.getColumnAt(1).labelFunction = setLabel;
}
function setLabel(item:Object, columnName:String): String {
if(item.rank == '1')
{
return 'active';
}
else
{
return 'not active';
}
};
</cfformitem>
<cfgrid name="myGrid" rowHeight="50" rowheaders="false" query="SelectQry" width="250" height="230">
<cfgridcolumn header="rank" name="rank">
<cfgridcolumn name="firstname" header="Name">
</cfgrid>
</cfform>
</body>
</html>
Thank you very much in advance!
Kind regards,
Diana
Biswajit Mojumdar
<cfform>
<cfgrid attributecollection="#args#">
<cfgridcolumn name = "CTEffDt" header = "Effective Date">
</cfgrid>
</cfform>
Biswajit Mojumdar
<cfform>
<cfgrid attributecollection="#args#">
<cfgridcolumn name = "CTEffDt" header = "Effective Date">
</cfgrid>
</cfform>