Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 04-07-2008, 08:14 PM   #1
cmgmyr
Registered User
 
Join Date: Dec 2007
Location: Syracuse, NY
Posts: 15
Default Filter Function

Hey All,
I have a datagrid hooked up to an XML file through an HTTPService I would like to add a checkbox to each row so that the user can select which rows they want to view together. Then when they click a checkbox outside of the datagrid it will show only the selected rows. How do I do something like that?

Thanks,
-Chris
cmgmyr is offline   Reply With Quote
Old 04-07-2008, 08:52 PM   #2
drkstr
Flexpert
 
drkstr's Avatar
 
Join Date: Sep 2006
Location: Seattle, WA: USA
Posts: 1,587
Default

I would type your dataProvider as an XMLListCollection, then set the filterFunction property on it.


Best Regards,
~Aaron
drkstr is offline   Reply With Quote
Old 04-07-2008, 10:07 PM   #3
cmgmyr
Registered User
 
Join Date: Dec 2007
Location: Syracuse, NY
Posts: 15
Default

Sorry, but I'm not quite sure what you mean...I'm still new at this stuff. Here is my datagrid
Code:
<mx:DataGrid dataProvider="{diamondList}" x="34" y="141" width="1068" height="459" id="diamondSearchList" editable="false" enabled="true">
	    <mx:columns>
	        <mx:DataGridColumn headerText="Lot Number" dataField="lot_number" />
	        <mx:DataGridColumn headerText="Shape" dataField="shape" />
	        <mx:DataGridColumn headerText="Size" dataField="carat" />
	        <mx:DataGridColumn headerText="Color" dataField="color" />
	        <mx:DataGridColumn headerText="Clarity" dataField="clarity" />
	        <mx:DataGridColumn headerText="Cut" dataField="cut" />
	        <mx:DataGridColumn headerText="Lab" dataField="lab" />
	        <mx:DataGridColumn headerText="Pol." dataField="polish" />
	        <mx:DataGridColumn headerText="Sym." dataField="symmetry" />
	        <mx:DataGridColumn headerText="Depth" dataField="depth" />
	        <mx:DataGridColumn headerText="Table" dataField="table" />
	        <mx:DataGridColumn headerText="Measurements" dataField="measurements" width="130" />
	        <mx:DataGridColumn headerText="Price" dataField="price" />
	    </mx:columns>
	</mx:DataGrid>
Thanks,
-Chris
cmgmyr is offline   Reply With Quote
Old 04-08-2008, 07:35 AM   #4
kahuja
Maverick
 
kahuja's Avatar
 
Join Date: Mar 2008
Location: India
Posts: 225
Send a message via AIM to kahuja Send a message via Yahoo to kahuja
Default

Some steps (I do not have the time to code it up just yet); hoping you can read through some of the help:

1. Use an Item Rendered to put in check boxes in the DataGrid;
2. Make sure that as you are clicking on the Check boxes, they register the "Selected" with an array collection
2a. Alternatively, you can also, read the check box state later, but I prefer a more real-time approach, saves time later;
3. Once a user clicks on the check box outside the grid, read the ids as stored earlier and then apply filter on the XMListCollection.
- Filter is a capability that Collections provide in ActionScript.

Refer to livedocs for more help
__________________
Happy Flexing !!
k.

Scratch Pad
kahuja is offline   Reply With Quote
Old 04-08-2008, 07:37 AM   #5
kahuja
Maverick
 
kahuja's Avatar
 
Join Date: Mar 2008
Location: India
Posts: 225
Send a message via AIM to kahuja Send a message via Yahoo to kahuja
Smile

Look at thread: http://www.actionscript.org/forums/s...806#post728806
__________________
Happy Flexing !!
k.

Scratch Pad
kahuja is offline   Reply With Quote
Old 04-08-2008, 12:18 PM   #6
cmgmyr
Registered User
 
Join Date: Dec 2007
Location: Syracuse, NY
Posts: 15
Default

great thanks! I will try that out.
cmgmyr is offline   Reply With Quote
Old 04-08-2008, 07:25 PM   #7
kahuja
Maverick
 
kahuja's Avatar
 
Join Date: Mar 2008
Location: India
Posts: 225
Send a message via AIM to kahuja Send a message via Yahoo to kahuja
Default

and do not forget back to let me know how it went :-)
__________________
Happy Flexing !!
k.

Scratch Pad
kahuja is offline   Reply With Quote
Old 04-11-2008, 11:40 PM   #8
cmgmyr
Registered User
 
Join Date: Dec 2007
Location: Syracuse, NY
Posts: 15
Default sorry...

Hey, sorry it took so long to get back to you about the post. I did some research and I got a little further. I got the checkbox in there ok by using
Code:
<mx:DataGridColumn headerText="Compare" itemRenderer="mx.controls.CheckBox" textAlign="center" />
but then when I tried to go on from there I hit a brick wall.

I've tried to do searches for what you are saying but I couldn't find anything that is similar to what I want to do.

Where do I go from here? Can you give me or point me to an example of what I want to do? Sorry for being so "thick" but this just isn't clicking for me.

On a side note, I come from a PHP background and it is very easy to find resources and examples of TONS of things. How come it doesn't seem like that that with flex? Am I not looking in the right direction? Is it still too "new" and not enough people have a good grasp of it yet?

Thanks!
-Chris
cmgmyr is offline   Reply With Quote
Old 04-13-2008, 07:32 AM   #9
kahuja
Maverick
 
kahuja's Avatar
 
Join Date: Mar 2008
Location: India
Posts: 225
Send a message via AIM to kahuja Send a message via Yahoo to kahuja
Default

I am underway of bogging about Collections and how can you get the Filters using. I am not there yet as this is one of many threads that I am trying to juggle with.

Meanwhile, you can go through the following example of managing 3 check-box(s) as provided by Adobe. See if that helps.

http://www.adobe.com/cfusion/communi...45&productId=2
__________________
Happy Flexing !!
k.

Scratch Pad
kahuja is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
one template, many looks? subquark ActionScript 1.0 (and below) 1166 10-29-2013 06:18 PM
calculating tangent to the curve point DanglingChap ActionScript 3.0 21 03-12-2008 06:08 AM
Ease parameter Clutchplate Simple Stuff (Newbies) 8 03-16-2007 11:21 AM
flash movie plays in browser too slow m1cky ActionScript 2.0 7 01-11-2005 08:11 PM
can't call a function from within itself, what's my alternative? Jessica lucidiastudios ActionScript 1.0 (and below) 9 11-26-2003 10:03 AM


All times are GMT. The time now is 02:13 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.