hi Tim, thanks your solution worked well. for anyone who is interested
in filtering a datagrid with multiple criteria here is how i pieced up
mine through the enormous help from this group.
filters//
Good deal. A lot of refreshing going on there though. :-)
-TH
--- In flexcoders@yahoogroups.com, stinasius [EMAIL PROTECTED] wrote:
hi Tim, thanks your solution worked well. for anyone who is interested
in filtering a datagrid with multiple criteria here is how i pieced up
mine through the
Ok, enough f%#king around, please try to isolate the slider filter
function and behavior first. Below is the basic structure of what you
need to do with the slider. Please give it a try and when you get this
working, move on to combining it with the comboBoxes.
-TH
private var sliderFromValue
Ok, enough messing around, please try to isolate the slider filter
function and behavior first; before trying to add it to the comboBox
filtes. Below is a basic sturcture of what you need to do. Please give
it a try and when you get this working, move on to combining it with the
comboBoxes.
Still think that you need to take out values=[0,300]. This will
lock the sliders to either of those values; with nothing in between.
-TH
--- In flexcoders@yahoogroups.com, stinasius [EMAIL PROTECTED] wrote:
hi guy i appreciate that you are really trying to help. but so far i
still have
when i take out values=[0,300] there is no change in the
behavior. is the way i call the filter function on the change events
of the combos and slider correct? have a feeling that's what is
causing the problem.
hi guy i appreciate that you are really trying to help. but so far i
still have the same problem, when i remove the slider from the filter
equation the datagrid is filtered but when i add it something wired
happens(the data disappears from the grid) here is a sample of my code
and i call the
hi guys i hope am not being a pain, but how can i use a combo box and
a slider (two thumbed) to fliter a datagrid? a small code sample will
do it. thanks.
No worries,
It looks like your filter function already uses the comboBox's
selectedLabel to compare. You can initiate the filter like this:
private function filterDataGrid():void
{
myArrayCollection.filterFunction = myFilterFunction;
myArrayCollection.refresh();
}
mx:ComboBox
I don't have a tested code sample to offer, but you would use the fact
that your DataGrid's dataProvider has probably been turned into an
ArrayCollection, which has a filterFunction property. You set the
filterFunction to be a reference to a method that takes a single data
item as an argument and
Waiting on a server-side bugfix, so enjoy. Working example:
?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute
mx:Script
![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
private var
hi josh nice example but how about using one slider with two thumbs?
Don't know, I imagine the first step will be building or locating a
dual-thumb slider :)
On Wed, Aug 6, 2008 at 4:42 PM, stinasius [EMAIL PROTECTED] wrote:
hi josh nice example but how about using one slider with two thumbs?
--
Flexcoders Mailing List
i managed to build a dual thumb slider that i pass on the filter
function. here is the code.
mx:HSlider x=0 y=240 id=priceSlider minimum=0
maximum=300 tickInterval=10 snapInterval=10
thumbCount=2 values=[0,300] tickColor=#ff
labels=[$0k,$300M] liveDragging=true width=182
Shows how often I use the sliders. I didn't know you could use multiple
thumbs... This is not performant, you should be getting the max and min
within updateFilter() and sticking them in private vars, not in the filter
function itself... but you get the idea.
private function
Yeah shoot, my bad. Take the values property out of the tag. Should
have said set the min to 0 and the max to 3,000,000 (like you have it.
The values will lock the thumbs to those two positions (values) only.
-TH
--- In flexcoders@yahoogroups.com, Josh McDonald [EMAIL PROTECTED] wrote:
And go back to your original filterFunction:
if ( (city_cb.selectedLabel == All || item.city ==
city_cb.selectedLabel) (lct_cb.selectedLabel == All ||
item.location == lct_cb.selectedLabel) (item.value
priceSlider.values[0] item.value priceSlider.values[1])
){
result=true;
}
return result;
Complete example with 2 thumbs (from the earlier example):
?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute
mx:Script
![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
private var
Hey Josh,
What's up with:
return item.value =
Math.min(priceSlider.values[0],priceSlider.values[1])
item.value =Math.max(priceSlider.values[0],priceSlider.values[1]);
You can avoid this by setting allowThumbOverlap=false. Then just use:
return item.value = priceSlider.values[0] item.value
Coz it's a quick and nasty (but working) example, and I have zero knowledge
about the finer details of the slider controls :)
On Thu, Aug 7, 2008 at 9:28 AM, Tim Hoff [EMAIL PROTECTED] wrote:
Hey Josh,
What's up with:
return item.value =
FWIW, If I were building this for users, I'd still allow sliders to overlap
for ease-of-use purposes, but I'd fetch max and min on change rather than
every loop of the filter function ;-)
-Josh
On Thu, Aug 7, 2008 at 9:31 AM, Josh McDonald [EMAIL PROTECTED] wrote:
Coz it's a quick and nasty
No worries. Actually, allowThumbOverlap=false is the default. For
me, allowing thumb overlap would purly depend on the use case. My
opinin is that it makes more sense to the user to not allow the right
thumb to go past the left thumb and vice versa. but, IMHO. Good
example.
-TH
--- In
It's probably just a personal preference. You're thinking max and min
thumbs, I'm thinking between foo and bar :)
I was just thinking about the use case where the user has min = 1000, max =
2000 and wants to set min=0, max=800 - without thumb overlapping, you've
gotta move the min thumb first,
hi thanks for the link, maybe you can help me out here, i am filtering
the datagrid using three controls (2 combo boxes and a slider), the
filter works without the slider but when i add the slider into the
equation nothing shows up in the data grid when each control is
clicked. here is my filter
Hi,
Your code for the filter function looks fine. Must be a data or slider
value issue. Make sure that you set the slider's values array to two
values that would include all of the prices in the dataProvider. It's
possible that the range of values for the slider is too low or high;
thus
hi my price ranges are between 0 and 3,000,000 so should my max value
be 3,000,000 or 1? thanks
mx:HSlider values=[0,30]/
--- In flexcoders@yahoogroups.com, stinasius [EMAIL PROTECTED] wrote:
hi my price ranges are between 0 and 3,000,000 so should my max value
be 3,000,000 or 1? thanks
hi i tried just that but nothing shows up in my datagrid when i filter
it. what could be the problem? here is my update filter function
public function filterGrid():void{
dataAr.filterFunction=cityFilter;
dataAr.refresh();
Make sure your filter function returns true for some of the data
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of stinasius
Sent: Tuesday, August 05, 2008 10:14 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: filtering a flex
hi my filter function returns true for some of the data and in fact
when i remove the slider filter statement, everything works well.
another thing is that i set the onChange function of the combo boxes
and the slider to filterGrid(). is that ok or am doing it the wrong way?
removing the filterfunction doesn't really prove anything. Whenever you
call refresh() after you've assigned the filterFunction, your
filterfunction should get called. If you add a trace statement, you
should see it once per item in the dataprovider.
From:
hi if you dont mind could you clarify on the trace statement, am not
sure i understand what you said or how to go about it. thanks
You'll want to listen for the change event on the slider. In the
event handler you can do something like this...
collection.filterFunction = filterByPriceRange;
collection.refresh();
Then you'll want your filterByPriceRange function to return true if
the price of the given object is between the
hi am fairly new to flex. if you dont mind maybe you could post some
small example on how to do it. thanks
flexexamples is a great site for fully functioning code snippets.
In the example here
http://blog.flexexamples.com/2008/03/12/using-a-combobox-to-filter-items-in-a-datagrid-in-flex/
you'll want to swap out the CheckBox for a HSlider, obviously. Then
you can call toggleFilter() when the slider
35 matches
Mail list logo