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.


<cfajaxproxy cfc="live.components.orders" jsclassname="callordersCFC"/>

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


<InvalidTag type="text/javascript">
function init(){
grid = ColdFusion.Grid.getGridObject("ordersSearch");
var gridHead = grid.getView().getHeaderPanel(true);
var tbar = new Ext.Toolbar(gridHead);

//delete order button
     tbar.addButton({
text:"Delete Order",
cls:"x-btn-text-icon",
icon:"./images/icons/package_delete.png",
handler:onDeleteOrder
});
console.log(tbar);         
}

[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]


IIS's compression scheme incompatible with CFHTTP

Today some of our sites that make CFHTTP calls to Protx's VSP Direct Server stopped working! The CFHTTP response I was getting back was "Connection Failure: Status code unavailable".

A quick search one the Net and I came across this post: Workaround for CFHTTP and Compressed HTTP Response from IIS.

Basically it's to do with the HTTP Compression in IIS. CFHTTP couldn't read the compressed header. This is due to IIS's compression scheme being incompatible with CFHTTP, so I have read.

The quick fix was to add the following CFHTTPPARAM to the CFHTTP post so the header is sent back uncompressed.


<cfhttpparam type="Header" name="Accept-Encoding" value="deflate;q=0">
<cfhttpparam type="Header" name="TE" value="deflate;q=0">

This resolved the problem, however this issue according to some other blog posts I read was resolved in MX7 Cumulative Hot Fix back in 9/10/2007, however I am running CF 8.01 maybe this needs addressing again?


Sava: no ALT Attributes in Gallery

The galleries created in Sava do not produce any alt text on the images. I dont see anywhere in Sava where you can insert alt text for the images so you will need to edit the /default/includes/display_objects/gallery/index.cfm file and add them.

You can add an empty alt attributes to the IMG elements there however that would means the page will still not validate so the best option is to add the image summery and strip out the HTML. This works ok if you dont have a long summery for the image.


alt="#REReplaceNoCase(rsSection.summary,'<[^>]*>
','','ALL')#"

This is something that will need to be address in Sava as with the latest accessibility laws alt text has never been some important.


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...


<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.


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

More Entries

 

About Me

Glyn Jackson, 26 years old, MD and youngest member of a web 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 using ColdFusion for just 3 years but 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