Uncategorized
Adding a Filter to your flash form in cfmx7
Following the lead of Kai over at Blog In Black, i am posting something i have been working on.
As soon as cfm7 was posted I heard some rumbling about folks wishing they could filter the results of a cfgrid on the client side. I thought that was something I would could work on. So I started some psuedo code and gave it some thought and then promptly got side tracked.
So seeing Kai’s post this morning brought me back to this and I thought i would share my thoughts, and build on his work. Its not perfect, but its a start and perhaps someone better with Actionscript could clean it up ;)
Read on for the code sample.
08 Mar 2005 Simeon

So I should probably mention the things that I see a problem with right away.
1. Because I dont have an onload, i dont currently have anything forcing the data to reload the shared object. i will probably add a time stamp to the SO that is created by cf so i can know when people refreshed the page.
2. When you filter the data, the row numbers go away. Not sure what that column is called. I tried taking a cue from flex and adding a column named currentItem (thanks spike) but that didnt help. I also tried CurrentItem, currentitem, currentrow, currentRow, and CurrentRow.
But feel free to comment if you have any ideas on how to make those display.
Hi Simeon,
I modified a little bit your code and made an entry on my blog (http://asfusion.com/blog/) about it. I was wondering why you used the share object to store your data. Do you want to retrieve the selection from the SO when you refresh the page?
Well here is what I ran into, and someone with better AS background might now better.
Because all my code is located in the onChange method of the select, anything I declare in there appears to be local. I was not able to instantiate a _global varialbe and I needed to store the original data for use after the first filter.
So because anything declared in there is local it is overwritten everytime I call the function. I used the SO after not being able to find another way store the data between filter requests.
What this led to was the problem that even on refrsh the data is not updated, which is a problem. Something I think can be fixed by setting a timestamp in the SO that is chaged at refresh by CF. That way I know when to update the data.
I would love for someone to have a better method to make this happen. But as I am limited in my AS knowledge and I am playing with features that are unsupported/unwanted by MM I thought it was a good head start.
Let me know what you think or if you have better ideas for the data storage.
Actually after seeing your code, I see that you did make the _global var work!
So good on you :)
Did you have any luck with the row numbers?
I Simeon,
I have the numbers working in my example (http://asfusion.com/blog/files/cfforms/filterGrid.cfm). I not sure if this is the behavior that you want.
Hy my name is Marcio i’m from brasil my email is hackin88@yahoo.com.br
————–
Because the syntax getURL("http://www.macromedia.com", "_blank", "POST"); she is not
being executed. I want that in case that returns 1 either redirected
for another archive
——————-
<cfsavecontent variable="callingCFC">
var dataholder = this.createEmptyMovieClip(’dataholder’,4587);
dataholder.method = "Logar";//the cfc method
dataholder.usuario = usuario.text; //the parameter
dataholder.senha = senha.text; //the parameter
dataholder.loadVariables (’login.cfc’, ‘POST’);//note the component name with full path
var obj = {};
var checkData = function(obj){
if(dataholder.Success != undefined){
if(dataholder.Success == 0){
alert("Usu