CFGRID Custom Delete

I am using an example I customised from Dan Vega's Blog on CFGRID. I wanted to add my own delete function to the grid and not using the delete="yes". The function needed to pass the selected ID to a CFC delete function. I decided to use my new found love of cfajaxproxy, what I am not sure about is if I have gone about doing this in the best way. I could not find any examples and my solution does work well, but I cannot help feeling I have gone the long way around this? Without knowing where to look I cannot be sure.


Anyway here is what I did, right or wrong it works.

Created the CFC (with has my delete function) as a JavaScript object.

view plain print about
1<cfajaxproxy cfc="live.components.orders" jsclassname="callordersCFC"/>

Setup my grid and buttons, just the delete button in this example.

view plain print about
1<InvalidTag type="text/javascript">
2function init(){
3 grid = ColdFusion.Grid.getGridObject("ordersSearch");
4 var gridHead = grid.getView().getHeaderPanel(true);
5 var tbar = new Ext.Toolbar(gridHead);
6
7//delete order button
8     tbar.addButton({
9 text:"Delete Order",
10 cls:"x-btn-text-icon",
11 icon:"./images/icons/package_delete.png",
12 handler:onDeleteOrder
13 });
14 console.log(tbar);         
15 }

[More]

CFAJAXPROXY - JavaScript object from a CFC

So its boxing day, I am sitting back and having a few beers playing around with some CF8 tags that I have not used very much over the course of the year. A few of my fellow CF developers have been saying the best tag added to ColdFusion 8 was cfajaxproxy, to be honest I don't know what all the fuss is about, until now.

I have been meaning to update some functions in SalesMaxx particularly the shopping cart and with a few beers down and nothing but reruns on TV what a better time to try cfajaxproxy.

[More]

Submitting a CFFORM inside a CFDIV

I came across a problem submitting a CFFORM inside a CFDIV container. Normally any CFFORM submitted inside a CFDIV container will be posted back to the CFDIV (thanks CF for all the built in functions that make my life easy).... so I assumed below would work...

view plain print about
1<cfform>
2 Items Per Page:
3 <cfselect name="sortby" onChange="submit()">
4 <option value ="0"></option>
5 <option value ="0">Lowest Price</option>
6 <option value ="1">Highest Price</option>
7 </cfselect>
8 </cfform>

but because I was not using the regular submit button none of ColdFusion's built-in ajax form submission events were being triggered as a result.

a simple work around...

view plain print about
1<InvalidTag>
2submitsortby = function() {
3javaScript:ColdFusion.navigate('productpage.cfm','productlistDiv',null,null,'get','sortbyFrm');return false;
4}
5</script>
6
7
8<cfform id="sortbyFrm" name="sortbyFrm">
9 Items Per Page:
10 <cfselect name="sortby" onChange="submitsortby()">
11 <option value ="0"></option>
12 <option value ="0">Lowest Price</option>
13 <option value ="1">Highest Price</option>
14 </cfselect>
15 </cfform>

however I am curious as there must be a another way to call CF's built-in AJAX form submission event without using "ColdFusion.navigate"? I have tired a number of other things like using "document.sortbyFrm.submit(), ColdFusion.ajax.submitForm()" but with no results.

Sava CMS Content Ratings Portal Inheritance

Before I begin....

I am really starting to enjoy Sava CMS the guys/girls are a credit to the CF community. The helpfulness on their forum is also very commendable, there were cases where I asked a question or made simple feature requests and they updated the version of Sava with fixes or the features within hours of the request.

I have decided to start making some little write ups and contribute in anyway I can. I don't fully know the system yet or make claims to be any CF guru as i am just starting out, however I like to learn so don't shoot me down straight away.

There also maybe other ways in Sava that I have not yet investigated do so some of the things I suggest here or in anyother post I make. The main problems I have found are with SEO in Sava, however I will post bits on that as I play.

Content Ratings Portal Inheritance

The first thing I wanted to write about was a simple fix on an issue I had setting up a portal and adding the content rating to it.

In Sava to stop the repetitive task of manually adding objects like the 'content rating' to every new page created under a portal you can you setup a portal with Inheritance Rules such as 'Start New Cascade', this means that anything added under that particular portal will inherit the display object(s) by default of the Portal its under.

However the portal page itself also has the display object on it when you do this. Its only the content I wanted to be rated not the actual portal page so this needed removing.

[More]

LightBox Gallery With CFIMAGE To Resize

This is some code I did when I first started to play with CFIMAGE it has been useful so felt like sharing.

I client of mine spent a lot of time uploading and adding images to his static gallery page he used Lightbox. He had to create 2 images each time one a thumbnail and the other a large size image, then he had to add each image to his page like so...

view plain print about
1<a href="img/gallery/large/example.jpg" rel="lightbox[projects]" ><img src="img/gallery/example.jpg"/></a>

This was ok at first but it started to get untidy, you know how it is, images being taking off, new images being added, long lines of img tags, messy.

Anyhow, simple bit of code, only took around 2 minutes (I love ColdFusion). Now all he does is upload 1 large image to his image directory and it appears in his gallery. Thumbnails are created on the fly and it still works with his Lightbox.

view plain print about
1<cfset imagesFolder = "./img/gallery/"><!---change to your image directory--->
2<cfset varWidth = "100"><!---image width in px--->
3<cfset varHight = "100"><!---image height in px --->
4<!---get all images from you above specified directory--->
5<cfdirectory action="list" directory="#ExpandPath(imagesFolder)#" recurse="true" name="gallery" filter="*.jpg"/>
6<!---resize and output all images to the browser--->
7<cfoutput query="gallery">
8<cfimage action="resize" source="#ExpandPath('#imagesFolder##gallery.name#')#" width="#varWidth#" height="#varHight#" name="ImageObject"/>
9<!---rel=lightbox[projects] is my light box group change to yours--->
10<a href="img/gallery/#gallery.name#" rel="lightbox[projects]" ><cfimage action="writetobrowser" source="#ImageObject#"/></a>
11</cfoutput>

Adobe ColdFusion 8 eSeminar Series

Spotted a post on Sean A Corfield blog (corfield.org) that Adobe are running a number of one-hour online seminars on ColdFusion here. Worth a look I think. If your in the UK here is a cool tool that will help you work out the time for us.

I have missed the first one myself, oops.

ColdFusion 8 Developer Tutorial Book

Until recently the Web Application Construction Kit series were the only books worth purchasing if learning ColdFusion 7/8. I have all 3 of these books and I often find myself picking bits out of each.

Although excellent books for someone just learning CF it can get expensive. This was a concern a local university shared and one of the key factors in the decision not to teach it. "Can students afford to buy all 3 books at almost £40 each just for a 6 week module?"

Today I got my copy of the ColdFusion 8 Developer Tutorial. One book covering all the basics and even some in depth AJAX stuff.

I just want to say thank you to John Farrar the author of the book for giving the ColdFusion community more options on reading material, and I hope this is the start of things to come. A great book for learning CF and the authors deserve praise.

If you are learning ColdFusion or new to some of the CF8 features I would recommend it. If you are an advanced CF user then it serves only as good refresher.

Universities you no longer have an excuse for not teaching the best web application development language!

CFDBINFO Returning ALL Datasources

Today I have been left slightly confused about the CFDBINFO tag. According to the Adobe documentation CFDBINFO lets you retrieve information about 'a' datasource, including details about the database, tables, queries, procedures etc, and this is true. Cool, as at the moment I am building an application to backup my user database.

I noticed it also seems to return a list of ALL the datasources including all datasources on another SQL sever we have in our cluster.

There is no security issue, it seems to be 'read only' and I need the username and password to get any information on the other tables.

There does not seem to be any information on this in the documentation.

New Priority Attribute in CFMAIL

ColdFusion 4.5 introduced the child tag CFMAILPARAM allowing you to add mail headers to a message

view plain print about
1<cfmail from="fromaddress" to="toaddress" subject="mail subject">
2 <cfmailparam name="priority" value="high" />
3 Body
4</cfmail>

In ColdFusion 8 this has changed a little, above is still valid, but 'priority' is now an attribute in the CFMAIL tag. The values the priority attribute can accept has been extended to allow integer values 1-5, 1 being the highest priority.

view plain print about
1<cfmail from="fromaddress" to="toaddress" subject="mail subject" priority="1">
2 Body
3</cfmail>

I don't think there is any major advantage for the change other than it's much cleaner to read.

ColdFusion 8 also added useSSL, and useTLS attributes to CFMAIL

_UNKNOWNTRANSLATION_

 

About Me

Glyn Jackson, 28 years old, MD and senior developer of a development firm based in Staffordshire called Newebia Ltd. Academic background in BSc Information System & Internet Commerce. Online marketing expert (EE Ranked) and .NET developer. Has been developing with ColdFusion for 5 years and loves it. "I am not a veteran in ColdFusion but I do work on challenging projects which help me learn more about ColdFusion and if I can contribute to the community in anyway then, it's all good!"

Recommends

  • ColdFusion