<charlie griefer>

*tap*tap*tap* is this thing on?

flex images: visible property funkiness in itemRenderer

may 13, 2008 at 9:56pm in flex

in the flex app that i'm currently working on, i have a DataGrid that uses an itemRenderer to display an image. the image is a 'delete' button that allows the user to delete the item. fairly straightforward, and the code below was working fine...

  1. <mx:DataGridColumn width="24" sortable="false" paddingLeft="4" paddingRight="4" headerText="">
  2. <mx:itemRenderer>
  3. <mx:Component>
  4. <mx:Image source="assets/icon_delete.png" horizontalAlign="center" height="17" width="17" click="parentDocument.confirmDelete(event);" />
  5. </mx:Component>
  6. </mx:itemRenderer>
  7. </mx:DataGridColumn>

... until the customer called and said that the user should not be allowed to delete a record if that record meets a particular condition. ok. i think i can do that. i made some modifications and now had the following code:

  1. <mx:DataGridColumn width="24" sortable="false" paddingLeft="4" paddingRight="4" headerText="" dataField="CAN_DELETE">
  2. <mx:itemRenderer>
  3. <mx:Component>
  4. <mx:Image source="assets/icon_delete.png" horizontalAlign="center" height="17" width="17" click="parentDocument.confirmDelete(event);" visible="{data.CAN_DELETE == 1}" />
  5. </mx:Component>
  6. </mx:itemRenderer>
  7. </mx:DataGridColumn>

i added a "dataField" property to the DataGridColumn, and added a "visible" property to the image itself, bound to the value of CAN_DELETE. recompiled, and still saw that every record displayed the delete image. i wondered if my logic, as simple as it was, might have been off. just for kicks and giggles, i hard coded the value 'false' into the "visible" property of the image. still, it displayed for all records. now this was odd.

one of the big perks of my current job is that i get to work with tariq ahmed, flex guru and all around good guy. while he wasn't able to offer up a reason as to why this behavior was happening, he suggested throwing the image into an <mx:HBox> component. new code:

  1. <mx:DataGridColumn width="24" sortable="false" paddingLeft="4" paddingRight="4" headerText="" dataField="CAN_DELETE">
  2. <mx:itemRenderer>
  3. <mx:Component>
  4. <mx:HBox>
  5. <mx:Image source="assets/icon_delete.png" horizontalAlign="center" height="17" width="17" click="parentDocument.confirmDelete(event);" visible="{data.CAN_DELETE == 1}" />
  6. </mx:HBox>
  7. </mx:Component>
  8. </mx:itemRenderer>
  9. </mx:DataGridColumn>

you'll notice the only change is the addition of the <mx:HBox> around the <mx:Image>. for whatever reason, that worked perfectly. i don't pretend to know why, but i'm curious as heck. if you've got any ideas, please feel free to comment and enlighten me.

cf.Objective() is tomorrow...

april 30, 2008 at 3:04pm in conferences

i arrive @ MSP 2:03pm tomorrow. anybody else hitting town about that time wanna split a cab/shuttle from the airport? if so, ping me.

hello 40's

april 28, 2008 at 2:19am in way off-topic

just a quick update... the weekend camping excursion was a blast, and pitching the tent proved to be far less arduous of a process than i had expected (altho a few NSFW words were involved).

since a picture is worth 1000 words, i'll let the photos speak for themselves.

also posted a 1 minute youtube video of my daughters feeding a wild turkey, which was fairly comical.

good-bye 30's

april 24, 2008 at 3:16pm in way off-topic

today is the last day that i'll be "in my 30's". when i wake up tomorrow, i'll have hit the big four-oh.

i'd like to think i won't be too weirded out by it all, but it's already hitting me a little bit. feeling kinda... dunno really. just weird .

my company gives employees the day off on their birthday, so a three-day weekend will be nice. taking the family camping (our first camping outing). there's a nice campground not too far from here. it's about a 40 minute drive. 20 minutes horizontally, then 20 minutes vertically up a mountain. we drove there a couple of weekends ago to scope out the campsites, and reserved one that overlooks a lake.

should be a fairly serene setting to reflect on being old. i'll be completely "off-the-grid". no computer, no internet, and no cell (i'll have the phone but i'm not expecting any signal). the serenity may not actually start until i finish pitching the tent (which i expect to be wholly comical and probably contain some NSFW language). but the rest of it should be pretty cool.

40. ugh.

mxml is xml (duh?)

april 23, 2008 at 4:04pm in flex, flex for CF'ers

just a quickie today, something that i came across while playing around with flex. it could very well be a "duh, charlie" observation, but i think it bears mentioning.

flex makes it very easy to bind elements to other elements or objects. what this means is that a datagrid, for example, can be populated by the contents of an ArrayCollection (for CF'ers, think of an ArrayCollection as an array of structures). the first step is to declare the variable as bindable in your <mx:Script> block:

  1. [Bindable]
  2. private var myArray:ArrayCollection;

your DataGrid would then be declared as follows:

  1. <mx:DataGrid dataProvider="{myArray}" id="myDataGrid">

the curly braces around the value of the dataProvider attribute indicates that it's a bindable variable. all pretty straightforward. but there are other ways to use bind variables to influence the behavior of an element.

flex: Objects are like structures. kinda. (part ii)

april 18, 2008 at 1:34pm in ColdFusion, flex, flex for CF'ers

last night i started documenting my journey of learning flex, focusing on my use of the built-in Object datatype and some issues that i faced in that respect.

there was one other aspect of this that i meant to touch on. to recap, i was passing a single Object to a coldfusion CFC method. in my little coldfusion brain, i thought of this as being not unlike a structure. so, i expected the method to receive a single argument much like a struct with multiple keys.

let's say my actionscript function looked like this:

  1. var args:Object = new Object();
  2. args.stateCode = "CA";
  3. args.zipCode = "94583";
  4. args.territory = 3;
  5. // call the remote object method
  6. ro_Customers.getFilteredCustomers(args);

i created an Object, populated it with 3 variables (keys), and passed it as an argument to the getFilteredCustomers() method in my remote object (CFC). originally, my CFC looked like this:

  1. <cffunction name="getFilteredCustomers" returntype="query" access="remote">
  2. <cfargument name="filterCriteria" type="struct" required="true" />
  3. ...

i assumed that my args Object would be able to be referenced as a structure in the CFC. it's a single variable with key/value pairs just like a struct. but when i tried to reference #arguments.filterCriteria.stateCode# i found that the variable didn't exist.

what actually happens is that the CFC treats each value in the Object as its own argument. think argumentCollection instead of struct.

the correct code for the CFC's arguments is:

  1. <cffunction name="getFilteredCustomers" returntype="query" access="remote">
  2. <cfargument name="stateCode" type="string" required="false" />
  3. <cfargument name="zipCode" type="string" required="false" />
  4. <cfargument name="territory" type="number" required="false" />
  5. ...

aside from explicitly declaring each value in the Object, i set the 'required' attribute to false because in this case, not all of the values may be present in the Object. a user might choose to search only on stateCode, or only on zipCode, etc.

thank you charlie arehart

april 18, 2008 at 3:36am in ColdFusion

a couple of weeks ago i started looking at transfer. i found myself wishing that i hadn't missed out on mark mandel's presentation to the inland empire coldfusion user's group that he had given a couple of months ago. heck i would have been thrilled to see any presentation on transfer right then and there.

in an all-too-rare moment of clarity, i remembered that charlie arehart has a compendium of links to recorded breeze/connect presentations, including six on transfer and, as of this writing, 231(!) on various other topics. very nice.

i've been aware that this existed for quite some time, but i guess i took it for granted until i actually found myself needing it. i meant to post something back then, not only to thank charlie but also to mention the UGTV page in case there might be a few folks out there who were unaware.

fast forward to today. somebody on the BACFUG mailing list asked a question about code generation. i pointed out two resources that i thought may be of use (one being peter farrell's rooibos generator, the other being brian rinaldi's illudium p36 code generator).

flex: Objects are like structures. kinda.

april 18, 2008 at 2:52am in ColdFusion, flex, flex for CF'ers

over the past few months i've been lucky enough to have the opportunity to start playing around with flex at work. overall it's been a pretty good experience. i think flex itself is a very cool technology, and flexbuilder absolutely ROCKS as an IDE. of course, there have been hurdles. some i was able to overcome pretty easily, and some left scars. i figured i'd post some of them here and hopefully save some other flex n00bs the hassle of figuring things out the hard way.

the application that i'm currently working on is fairly straightforward. let's call it a user manager. i present a couple of comboboxes that let the user filter by certain criteria (state, zipcode, etc) and populate a datagrid with the list of users that were returned.

i chose to pass these values in a single object. in coldfusion, this single object would be a structure. flex, or more appropriately, actionscript, has a comparable datatype, simply called Object. an Object would be created as follows:

  1. var args:Object = new Object();
  2. args.stateCode = "CA";
  3. args.zipCode = "94583";
  4. args.territory = 3;

fairly straightforward when compared to a coldfusion structure:

  1. <cfset args = structNew() />
  2. <cfset args.stateCode = "CA" />
  3. <cfset args.zipCode = "94583" />
  4. <cfset args.territory = 3 />

my schedule for cf.Objective() 2008

april 10, 2008 at 4:11pm in conferences

cf.Objective() 2008 is just around the corner. registration is still open, and the deadline for the convention rate at the hotel has been extended until april 15th. if you've been putting off registration, the clock's ticking.

if you've already registered, be sure and use the online scheduler to sign up for sessions. which sessions get repeated on sunday are driven entirely by the number of people signing up for those sessions. kudos to the cf.Objective() team for getting the repeat sessions scheduled early. it really helps to know which ones will be repeated when you've got a scheduling conflict.

my current/tenative schedule:

cf.Objective() schedule

inexpensive cf hosting (update)

april 9, 2008 at 5:33pm in ColdFusion

because the question of inexpensive coldfusion hosting continues to come up frequently on mailing lists and forums, i'm posting an update to an post i made last year about hosting A to Z.

i'm no longer hosting with them, as i've moved to a VPS solution at AHP Hosting, but thought others might find this to be of some value. hosting A to Z has recently announced that they've upgraded from CF 7 to CF 8 (enterprise!). you can find a matrix of their cf plans at http://www.hostingatoz.com/shared_hosting.cfx.

the usual caveats definitely come into play when using shared hosting, but for those who are just looking to get started and aren't ready to spend money for a VPS or dedicated server (or even ready to spend $20 a month on shared hosting), it's definitely worth looking into. the most expensive CF 8 plan is $74.99 a year, and the cheapest is $29.99 (again, that's yearly, not monthly).

feel free to check out the entry under "related blog entries" for my previous post on the subject and a review. to recap, there was some good, and there was some bad... but they definitely fill a need for those who may just be getting started.



 
© 1920-2008, charlie griefer - design based on *Limelight* by www.mitchinson.net
blogCFC was created by raymond camden. this blog is running version 5.9.002.

CSS | XHTML