[flexcoders] Re: filtering a flex datagrid using a slider with two thumbs

2008-08-14 Thread stinasius
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//
private var sliderFromValue : Number = 0;
private var sliderToValue : Number = 300;
private var selectedCity : String = All;
private var selectedLocation : String = All;

private function onSliderChange(event:SliderEvent):void
{
var slider:Slider = Slider(event.currentTarget) ;
sliderFromValue = priceSlider.values[0];
sliderToValue = priceSlider.values[1];
filterGrid() ;
dataAr.refresh();
}
private function cityChangeHandler(event:Event):void
{
if( city_cb.selectedItem != null )
selectedCity = city_cb.selectedLabel;
filterGrid();
dataAr.refresh();
}

private function locationChangeHandler(event:Event):void
{
if( lct_cb.selectedItem != null )
selectedLocation = lct_cb.selectedLabel;
filterGrid();
dataAr.refresh();
}


private function filterGrid() :void
{
dataAr.filterFunction=myFilterFunction;
dataAr.refresh();
}

private function myFilterFunction(item:Object): Boolean
{
return (item.city == selectedCity || selectedCity == 
All)  
(item.location == selectedLocation || selectedLocation 
==
All)  
(item.price = sliderFromValue  item.price = 
sliderToValue) ;
}
then on each of the controls in my case 2 combo boxes and a slider
call their individual filter functions in the change event like this

mx:ComboBox x=0 y=108 width=182 id=lct_cb
labelField=lct_name change=locationChangeHandler(event)
selectedIndex=0/

mx:ComboBox x=0 y=52 width=182 id=city_cb
labelField=city_name change=cityChangeHandler(event)
selectedIndex=0/

mx:HSlider x=0 y=240 id=priceSlider minimum=0
maximum=300 allowThumbOverlap=false tickInterval=10
snapInterval=10 thumbCount=2 values=[0,300]
tickColor=#ff labels=[$0k,$300M] liveDragging=true
width=182 change=onSliderChange(event)/
hope someone will find this useful. thanks



[flexcoders] Re: filtering a flex datagrid using a slider with two thumbs

2008-08-14 Thread Tim Hoff

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 enormous help from this group.


filters/\
/
 private var sliderFromValue : Number = 0;
 private var sliderToValue : Number = 300;
 private var selectedCity : String = All;
 private var selectedLocation : String = All;

 private function onSliderChange(event:SliderEvent):void
 {
 var slider:Slider = Slider(event.currentTarget) ;
 sliderFromValue = priceSlider.values[0];
 sliderToValue = priceSlider.values[1];
 filterGrid() ;
 dataAr.refresh();
 }
 private function cityChangeHandler(event:Event):void
 {
 if( city_cb.selectedItem != null )
 selectedCity = city_cb.selectedLabel;
 filterGrid();
 dataAr.refresh();
 }

 private function locationChangeHandler(event:Event):void
 {
 if( lct_cb.selectedItem != null )
 selectedLocation = lct_cb.selectedLabel;
 filterGrid();
 dataAr.refresh();
 }


 private function filterGrid() :void
 {
 dataAr.filterFunction=myFilterFunction;
 dataAr.refresh();
 }

 private function myFilterFunction(item:Object): Boolean
 {
 return (item.city == selectedCity || selectedCity == All) 
 (item.location == selectedLocation || selectedLocation ==
 All) 
 (item.price = sliderFromValue  item.price = sliderToValue) ;
 }
 then on each of the controls in my case 2 combo boxes and a slider
 call their individual filter functions in the change event like this

 mx:ComboBox x=0 y=108 width=182 id=lct_cb
 labelField=lct_name change=locationChangeHandler(event)
 selectedIndex=0/

 mx:ComboBox x=0 y=52 width=182 id=city_cb
 labelField=city_name change=cityChangeHandler(event)
 selectedIndex=0/

 mx:HSlider x=0 y=240 id=priceSlider minimum=0
 maximum=300 allowThumbOverlap=false tickInterval=10
 snapInterval=10 thumbCount=2 values=[0,300]
 tickColor=#ff labels=[$0k,$300M] liveDragging=true
 width=182 change=onSliderChange(event)/
 hope someone will find this useful. thanks






[flexcoders] Re: filtering a flex datagrid using a slider with two thumbs

2008-08-11 Thread Tim Hoff

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 : Number = 0;
private var sliderToValue : Number = 300;

private function onSliderChange(event:SliderEvent):void
{
  var slider : Slider = Slider(event.currentTarget);
  sliderFromValue = mySlider.values[0];
  sliderToValue = mySlider.values[1];
  filterGrid();
}

private function filterGrid():void
{
  dataAr.filterFunction=myFilterFunction;
  dataAr.refresh();
}

private function myFilterFunction(item : Object) : Boolean
{
   return (item.value = sliderFromValue  item.value =
sliderToValue);
}

mx:HSlider id=mySlider
  thumbCount=2
  snapInterval=10
  liveDragging=true
  minimum=0
  maximum=300
  allowThumbOverlap=false
  change=onSliderChange(event)/


--- In flexcoders@yahoogroups.com, stinasius [EMAIL PROTECTED] wrote:

 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.





[flexcoders] Re: filtering a flex datagrid using a slider with two thumbs

2008-08-11 Thread Tim Hoff

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.

-TH

private var sliderFromValue : Number = 0;
private var sliderToValue : Number = 300;

private function onSliderChange(event:SliderEvent):void
{
  var slider : Slider = Slider(event.currentTarget);
  sliderFromValue = slider.values[0];
  sliderToValue = slider.values[1];
  filterGrid();
}

private function filterGrid():void
{
  dataAr.filterFunction=myFilterFunction;
  dataAr.refresh();
}

private function myFilterFunction(item : Object) : Boolean
{
   return (item.value = sliderFromValue  item.value =
sliderToValue);
}

mx:HSlider id=mySlider
  thumbCount=2
  snapInterval=10
  liveDragging=true
  minimum=0
  maximum=300
  allowThumbOverlap=false
  change=onSliderChange(event)/


--- In flexcoders@yahoogroups.com, stinasius [EMAIL PROTECTED] wrote:

 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.





[flexcoders] Re: filtering a flex datagrid using a slider with two thumbs

2008-08-10 Thread Tim Hoff

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 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 filterGrid() function on the change event of the two
 combos and the slider, is that the correct way of doing it? hope this
 will help solve my problem. thanks

 mx:RemoteObject id=homeSvc destination=ColdFusion
 source=iestate.cfcs.homes1 showBusyCursor=true

fault=CursorManager.removeBusyCursor();Alert.show(event.fault.message)\

 mx:method name=load result=displayResult(event) /
 !--mx:method name=getCountries result=countryResult(event)/--
 mx:method name=getcities result=cityResult(event) /
 mx:method name=getlocation result=locationResult(event) /
 /mx:RemoteObject

 mx:ComboBox x=0 y=52 width=182 id=city_cb
 labelField=city_name change=filterGrid(); selectedIndex=0/
 mx:ComboBox x=0 y=108 width=182 id=lct_cb
 labelField=lct_name change=filterGrid() selectedIndex=0/
 mx:HSlider x=0 y=240 id=priceSlider minimum=0
 maximum=300 allowThumbOverlap=false tickInterval=10
 snapInterval=10 thumbCount=2 values=[0,300]
 tickColor=#ff labels=[$0k,$300M] liveDragging=true
 width=182 change=filterGrid()/
 mx:DataGrid width=50% height=100% id=dgrid
 dataProvider={dataAr} rowCount=20 change=animateMapOut();
 mx:columns
 mx:DataGridColumn headerText=Price dataField=price/
 mx:DataGridColumn headerText=BedRooms dataField=bedrooms/
 mx:DataGridColumn headerText=BathRooms dataField=bathrooms/
 !--mx:DataGridColumn headerText=Stories dataField=col4/--
 /mx:columns
 /mx:DataGrid



 /data

functions///\
//
 public function InitCountry():void{
 homeSvc.getCountries();
 }
 public function countryResult(event:ResultEvent):void{
 ctry_cb.dataProvider = event.result;
 }

 private var cityAr:ArrayCollection ;
 public function cityResult(event:ResultEvent):void{
 cityAr = event.result as ArrayCollection;
 //add an Object at the beginning of the areaAryCol
 var city:Object = {city_id: -1, city_name: All};
 cityAr.addItemAt(city, 0);
 //reset the areaCB's data provider to so the above
 //Object is display at the top of the combo box
 city_cb.dataProvider = cityAr ;
 cityAr.refresh();
 city_cb.selectedIndex = 0
 }

 private var lctAr:ArrayCollection ;
 public function locationResult(event:ResultEvent):void{
 lctAr = event.result as ArrayCollection;
 //add an Object at the beginning of the areaAryCol
 var location:Object = {lct_id: -1, lct_name: All};
 lctAr.addItemAt(location, 0);
 //reset the areaCB's data provider to so the above
 //Object is display at the top of the combo box
 lct_cb.dataProvider = lctAr ;
 lct_cb.selectedIndex = 0;
 }

 [Bindable]
 private var dataAr:ArrayCollection = new ArrayCollection;
 public function displayResult(event:ResultEvent):void{
 dataAr = new ArrayCollection( (event.result as
 ArrayCollection).source);
 }



filters/\
/

 public function filterGrid():void{
 dataAr.filterFunction=cityFilter;
 dataAr.refresh();
 //dgrid.selectedIndex = null;
 }

 public function cityFilter(item:Object):Boolean{
 var result:Boolean=false;

 if ( (city_cb.selectedLabel == All || item.city ==
 city_cb.selectedLabel)  (lct_cb.selectedLabel == All ||
 item.location == lct_cb.selectedLabel)
 ){
 result=true;
 }
 return result;
 }






[flexcoders] Re: filtering a flex datagrid using a slider with two thumbs

2008-08-10 Thread stinasius
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.



[flexcoders] Re: filtering a flex datagrid using a slider with two thumbs

2008-08-09 Thread stinasius
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 filterGrid() function on the change event of the two
combos and the slider, is that the correct way of doing it? hope this
will help solve my problem. thanks

mx:RemoteObject id=homeSvc destination=ColdFusion
source=iestate.cfcs.homes1 showBusyCursor=true
fault=CursorManager.removeBusyCursor();Alert.show(event.fault.message)
mx:method name=load result=displayResult(event) / 
!--mx:method name=getCountries 
result=countryResult(event)/--
mx:method name=getcities result=cityResult(event) /
mx:method name=getlocation result=locationResult(event) / 

/mx:RemoteObject

mx:ComboBox x=0 y=52 width=182 id=city_cb
labelField=city_name change=filterGrid(); selectedIndex=0/
mx:ComboBox x=0 y=108 width=182 id=lct_cb
labelField=lct_name change=filterGrid() selectedIndex=0/
mx:HSlider x=0 y=240 id=priceSlider minimum=0
maximum=300 allowThumbOverlap=false tickInterval=10
snapInterval=10 thumbCount=2 values=[0,300]
tickColor=#ff labels=[$0k,$300M] liveDragging=true
width=182 change=filterGrid()/
mx:DataGrid width=50% height=100% id=dgrid
dataProvider={dataAr} rowCount=20 change=animateMapOut();
mx:columns
mx:DataGridColumn 
headerText=Price dataField=price/
mx:DataGridColumn 
headerText=BedRooms dataField=bedrooms/
mx:DataGridColumn 
headerText=BathRooms dataField=bathrooms/
!--mx:DataGridColumn 
headerText=Stories dataField=col4/--
/mx:columns
/mx:DataGrid



/data
functions/
public function InitCountry():void{
homeSvc.getCountries();
}
public function countryResult(event:ResultEvent):void{
ctry_cb.dataProvider = event.result;
}   

private var cityAr:ArrayCollection ;  
public function cityResult(event:ResultEvent):void{ 

cityAr = event.result as ArrayCollection;   
 
//add an Object at the beginning of the areaAryCol
var city:Object = {city_id: -1, city_name: All};
cityAr.addItemAt(city, 0);
//reset the areaCB's data provider to so the above 
//Object is display at the top of the combo box
city_cb.dataProvider = cityAr ;
cityAr.refresh();
city_cb.selectedIndex = 0
}

private var lctAr:ArrayCollection ;  
public function locationResult(event:ResultEvent):void{ 

lctAr = event.result as ArrayCollection;
//add an Object at the beginning of the areaAryCol
var location:Object = {lct_id: -1, lct_name: All};
lctAr.addItemAt(location, 0);
//reset the areaCB's data provider to so the above 
//Object is display at the top of the combo box
lct_cb.dataProvider = lctAr ;
lct_cb.selectedIndex = 0;
}   

   [Bindable]
   private var dataAr:ArrayCollection = new ArrayCollection;
public function displayResult(event:ResultEvent):void{
dataAr = new ArrayCollection( (event.result as
ArrayCollection).source);   
}


filters//

 public function filterGrid():void{
 dataAr.filterFunction=cityFilter;
 dataAr.refresh();
 //dgrid.selectedIndex = null;  
 }
 
 public function cityFilter(item:Object):Boolean{
 

[flexcoders] Re: filtering a flex datagrid using a slider with two thumbs

2008-08-08 Thread stinasius
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.



[flexcoders] Re: filtering a flex datagrid using a slider with two thumbs

2008-08-08 Thread Tim Hoff

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 id=city_cb change=filterDataGrid()/


-TH

--- In flexcoders@yahoogroups.com, stinasius [EMAIL PROTECTED] wrote:

 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.





RE: [flexcoders] Re: filtering a flex datagrid using a slider with two thumbs

2008-08-08 Thread Gordon Smith
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 returns true or false to indicate whether the
item should be displayed.

 

For example, suppose the items in your dataProvider were Address
instances and you wanted to show only the ones for a particular state
selected in a stateComboBox. Then you'd write code like

 

private function myFilterFunction(item:Object):Boolean

{

return Address(item).state == stateComboBox.selectedLabel;

}

 

and somewhere set

 

myDataGrid.dataProvider.filterFunction = myFilterFunction;

 

To get the DataGrid to refresh when you select a different state, I
think you would call myDataGrid.invalidateList() in a hanlder for the
ComboBox's change event.

 

Gordon Smith

Adobe Flex SDK Team

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of stinasius
Sent: Friday, August 08, 2008 12:14 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: filtering a flex datagrid using a slider with
two thumbs

 

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.

 



Re: [flexcoders] Re: filtering a flex datagrid using a slider with two thumbs

2008-08-06 Thread Josh McDonald
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 allProducts : Array = [
{
name: Datsun 120y,
value : 1000
},
{
name: Nissan 350Z,
value : 55000
},
{
name: Porsche GT3,
value : 325000
},
{
name: HSV Clubsport,
value : 7
},
{
name: Mercedes SLR,
value : 120
},
{
name: Lada Niva,
value : 75
},
{
name: Ford Falcon XY GTHO,
value : 375000
},
{
name: Batmobile,
value : 654321
},
{
name: Ford Falcon XA GTHO,
value : 220
}];

[Bindable]
private var filteredList : ArrayCollection = new
ArrayCollection(allProducts);

private function updateFilter() : void
{
filteredList.filterFunction = myFilterFunction;
filteredList.refresh();
}

private function myFilterFunction(item : Object) : Boolean
{
//trace(filter item  + item +  between  + min.value + 
and  + max.value);
return item.value = min.value  item.value = max.value;
}

]]
/mx:Script

mx:DataGrid horizontalCenter=0 verticalCenter=0 width=410
height=354 dataProvider={filteredList}
mx:columns
mx:DataGridColumn headerText=Car Name dataField=name/
mx:DataGridColumn headerText=Value dataField=value/
/mx:columns
/mx:DataGrid
mx:HSlider verticalCenter=-191 horizontalCenter=0 minimum=0
maximum=200 id=min liveDragging=true change=updateFilter()/
mx:HSlider verticalCenter=191 horizontalCenter=0 minimum=0
maximum=200 id=max liveDragging=true change=updateFilter()
value=200/
mx:Label text=Min textAlign=right width=117
horizontalCenter=-147 verticalCenter=-191/
mx:Label text=Max textAlign=right width=117
horizontalCenter=-147 verticalCenter=191/

/mx:Application


On Wed, Aug 6, 2008 at 3:57 PM, stinasius [EMAIL PROTECTED] wrote:

 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


 

 --
 Flexcoders Mailing List
 FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 Search Archives:
 http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
 Links






-- 
Therefore, send not to know For whom the bell tolls. It tolls for thee.

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]


[flexcoders] Re: filtering a flex datagrid using a slider with two thumbs

2008-08-06 Thread stinasius
hi josh nice example but how about using one slider with two thumbs?



Re: [flexcoders] Re: filtering a flex datagrid using a slider with two thumbs

2008-08-06 Thread Josh McDonald
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
 FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 Search Archives:
 http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
 Links






-- 
Therefore, send not to know For whom the bell tolls. It tolls for thee.

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]


[flexcoders] Re: filtering a flex datagrid using a slider with two thumbs

2008-08-06 Thread stinasius
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
change=filterGrid()/



Re: [flexcoders] Re: filtering a flex datagrid using a slider with two thumbs

2008-08-06 Thread Josh McDonald
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 myFilterFunction(item : Object) : Boolean
{
return item.value =
Math.min(priceSlider.values[0],priceSlider.values[1])   item.value =
Math.max(priceSlider.values[0],priceSlider.values[1]);
}


On Wed, Aug 6, 2008 at 5:29 PM, stinasius [EMAIL PROTECTED] wrote:

 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
 change=filterGrid()/


 

 --
 Flexcoders Mailing List
 FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 Search Archives:
 http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
 Links






-- 
Therefore, send not to know For whom the bell tolls. It tolls for thee.

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]


[flexcoders] Re: filtering a flex datagrid using a slider with two thumbs

2008-08-06 Thread Tim Hoff

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:

 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 myFilterFunction(item : Object) : Boolean
 {
 return item.value =
 Math.min(priceSlider.values[0],priceSlider.values[1])  item.value =
 Math.max(priceSlider.values[0],priceSlider.values[1]);
 }


 On Wed, Aug 6, 2008 at 5:29 PM, stinasius [EMAIL PROTECTED] wrote:

  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
  change=filterGrid()/
 
 
  
 
  --
  Flexcoders Mailing List
  FAQ:
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
  Search Archives:
  http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo!
Groups
  Links
 
 
 
 


 --
 Therefore, send not to know For whom the bell tolls. It tolls for
thee.

 :: Josh 'G-Funk' McDonald
 :: 0437 221 380 :: [EMAIL PROTECTED]






[flexcoders] Re: filtering a flex datagrid using a slider with two thumbs

2008-08-06 Thread Tim Hoff

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;
}

priceSlider.values[300] doesn't exist.  Then as Alex suggests, walk
through the code with the debugger, or trace.

-TH

--- In flexcoders@yahoogroups.com, Tim Hoff [EMAIL PROTECTED] wrote:


 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 dznuts@ wrote:
 
  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 myFilterFunction(item : Object) : Boolean
  {
  return item.value =
  Math.min(priceSlider.values[0],priceSlider.values[1])  item.value
=
  Math.max(priceSlider.values[0],priceSlider.values[1]);
  }
 
 
  On Wed, Aug 6, 2008 at 5:29 PM, stinasius stinasius@ wrote:
 
   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
   change=filterGrid()/
  
  
   
  
   --
   Flexcoders Mailing List
   FAQ:
 http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
   Search Archives:
   http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo!
 Groups
   Links
  
  
  
  
 
 
  --
  Therefore, send not to know For whom the bell tolls. It tolls for
 thee.
 
  :: Josh 'G-Funk' McDonald
  :: 0437 221 380 :: josh@
 






Re: [flexcoders] Re: filtering a flex datagrid using a slider with two thumbs

2008-08-06 Thread Josh McDonald
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 allProducts : Array = [
{
name: Datsun 120y,
value : 1000
},
{
name: Nissan 350Z,
value : 55000
},
{
name: Porsche GT3,
value : 325000
},
{
name: HSV Clubsport,
value : 7
},
{
name: Mercedes SLR,
value : 120
},
{
name: Lada Niva,
value : 75
},
{
name: Ford Falcon XY GTHO,
value : 375000
},
{
name: Batmobile,
value : 654321
},
{
name: Ford Falcon XA GTHO,
value : 220
}];

[Bindable]
private var filteredList : ArrayCollection = new
ArrayCollection(allProducts);

private function updateFilter() : void
{
filteredList.filterFunction = myFilterFunction;
filteredList.refresh();
}

private function myFilterFunction(item : Object) : Boolean
{
return item.value =
Math.min(priceSlider.values[0],priceSlider.values[1])   item.value =
Math.max(priceSlider.values[0],priceSlider.values[1]);
}

]]
/mx:Script

mx:DataGrid horizontalCenter=0 verticalCenter=0 width=410
height=354 dataProvider={filteredList}
mx:columns
mx:DataGridColumn headerText=Car Name dataField=name/
mx:DataGridColumn headerText=Value dataField=value/
/mx:columns
/mx:DataGrid
!--mx:HSlider verticalCenter=-191 horizontalCenter=0 minimum=0
maximum=200 id=min liveDragging=true change=updateFilter()/
mx:HSlider verticalCenter=191 horizontalCenter=0 minimum=0
maximum=200 id=max liveDragging=true change=updateFilter()
value=200/
mx:Label text=Min textAlign=right width=117
horizontalCenter=-147 verticalCenter=-191/
mx:Label text=Max textAlign=right width=117
horizontalCenter=-147 verticalCenter=191/--

mx:HSlider horizontalCenter=0 verticalCenter=-200 id=priceSlider
minimum=0
maximum=300 tickInterval=10 snapInterval=10
thumbCount=2 values=[0,300] tickColor=#ff
labels=[$0k,$300M] liveDragging=true width=182
change=updateFilter()/

/mx:Application


On Thu, Aug 7, 2008 at 2:39 AM, Tim Hoff [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;
 }

 priceSlider.values[300] doesn't exist.  Then as Alex suggests, walk
 through the code with the debugger, or trace.

 -TH

 --- In flexcoders@yahoogroups.com, Tim Hoff [EMAIL PROTECTED] wrote:
 
 
  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 dznuts@ wrote:
  
   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 myFilterFunction(item : Object) : Boolean
   {
   return item.value =
   Math.min(priceSlider.values[0],priceSlider.values[1])  item.value
 =
   Math.max(priceSlider.values[0],priceSlider.values[1]);
   }
  
  
   On Wed, Aug 6, 2008 at 5:29 PM, stinasius stinasius@ wrote:
  
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
change=filterGrid()/
   
   

   
--
Flexcoders Mailing List
FAQ:
  http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo!
  Groups
Links
  

[flexcoders] Re: filtering a flex datagrid using a slider with two thumbs

2008-08-06 Thread Tim Hoff

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
=priceSlider.values[1);

-TH

--- In flexcoders@yahoogroups.com, Josh McDonald [EMAIL PROTECTED] wrote:

 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 allProducts : Array = [
 {
 name: Datsun 120y,
 value : 1000
 },
 {
 name: Nissan 350Z,
 value : 55000
 },
 {
 name: Porsche GT3,
 value : 325000
 },
 {
 name: HSV Clubsport,
 value : 7
 },
 {
 name: Mercedes SLR,
 value : 120
 },
 {
 name: Lada Niva,
 value : 75
 },
 {
 name: Ford Falcon XY GTHO,
 value : 375000
 },
 {
 name: Batmobile,
 value : 654321
 },
 {
 name: Ford Falcon XA GTHO,
 value : 220
 }];

 [Bindable]
 private var filteredList : ArrayCollection = new
 ArrayCollection(allProducts);

 private function updateFilter() : void
 {
 filteredList.filterFunction = myFilterFunction;
 filteredList.refresh();
 }

 private function myFilterFunction(item : Object) : Boolean
 {
 return item.value =
 Math.min(priceSlider.values[0],priceSlider.values[1])  item.value =
 Math.max(priceSlider.values[0],priceSlider.values[1]);
 }

 ]]
 /mx:Script

 mx:DataGrid horizontalCenter=0 verticalCenter=0 width=410
 height=354 dataProvider={filteredList}
 mx:columns
 mx:DataGridColumn headerText=Car Name dataField=name/
 mx:DataGridColumn headerText=Value dataField=value/
 /mx:columns
 /mx:DataGrid
 !--mx:HSlider verticalCenter=-191 horizontalCenter=0 minimum=0
 maximum=200 id=min liveDragging=true
change=updateFilter()/
 mx:HSlider verticalCenter=191 horizontalCenter=0 minimum=0
 maximum=200 id=max liveDragging=true change=updateFilter()
 value=200/
 mx:Label text=Min textAlign=right width=117
 horizontalCenter=-147 verticalCenter=-191/
 mx:Label text=Max textAlign=right width=117
 horizontalCenter=-147 verticalCenter=191/--

 mx:HSlider horizontalCenter=0 verticalCenter=-200
id=priceSlider
 minimum=0
 maximum=300 tickInterval=10 snapInterval=10
 thumbCount=2 values=[0,300] tickColor=#ff
 labels=[$0k,$300M] liveDragging=true width=182
 change=updateFilter()/

 /mx:Application


 On Thu, Aug 7, 2008 at 2:39 AM, Tim Hoff [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;
  }
 
  priceSlider.values[300] doesn't exist. Then as Alex suggests,
walk
  through the code with the debugger, or trace.
 
  -TH
 
  --- In flexcoders@yahoogroups.com, Tim Hoff TimHoff@ wrote:
  
  
   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 dznuts@ wrote:
   
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 myFilterFunction(item : Object) : Boolean
{
return item.value =
Math.min(priceSlider.values[0],priceSlider.values[1]) 
item.value
  =
Math.max(priceSlider.values[0],priceSlider.values[1]);
}
   
   
On Wed, Aug 6, 2008 at 5:29 PM, stinasius stinasius@ wrote:
   
 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
 change=filterGrid()/


 

 --
 Flexcoders Mailing List
 FAQ:
   http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 Search Archives:
 http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo!
   Groups
 Links




   
   
--
Therefore, send not to know For whom the bell tolls. It tolls
for
   thee.
   
:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: josh@
   
  
 
 
 
 
  
 
  --
  Flexcoders Mailing List
  FAQ:
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
  Search Archives:
  

Re: [flexcoders] Re: filtering a flex datagrid using a slider with two thumbs

2008-08-06 Thread Josh McDonald
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 =
 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
 =priceSlider.values[1);

 -TH

 --- In flexcoders@yahoogroups.com, Josh McDonald [EMAIL PROTECTED] wrote:
 
  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 allProducts : Array = [
  {
  name: Datsun 120y,
  value : 1000
  },
  {
  name: Nissan 350Z,
  value : 55000
  },
  {
  name: Porsche GT3,
  value : 325000
  },
  {
  name: HSV Clubsport,
  value : 7
  },
  {
  name: Mercedes SLR,
  value : 120
  },
  {
  name: Lada Niva,
  value : 75
  },
  {
  name: Ford Falcon XY GTHO,
  value : 375000
  },
  {
  name: Batmobile,
  value : 654321
  },
  {
  name: Ford Falcon XA GTHO,
  value : 220
  }];
 
  [Bindable]
  private var filteredList : ArrayCollection = new
  ArrayCollection(allProducts);
 
  private function updateFilter() : void
  {
  filteredList.filterFunction = myFilterFunction;
  filteredList.refresh();
  }
 
  private function myFilterFunction(item : Object) : Boolean
  {
  return item.value =
  Math.min(priceSlider.values[0],priceSlider.values[1])  item.value =
  Math.max(priceSlider.values[0],priceSlider.values[1]);
  }
 
  ]]
  /mx:Script
 
  mx:DataGrid horizontalCenter=0 verticalCenter=0 width=410
  height=354 dataProvider={filteredList}
  mx:columns
  mx:DataGridColumn headerText=Car Name dataField=name/
  mx:DataGridColumn headerText=Value dataField=value/
  /mx:columns
  /mx:DataGrid
  !--mx:HSlider verticalCenter=-191 horizontalCenter=0 minimum=0
  maximum=200 id=min liveDragging=true change=updateFilter()/
  mx:HSlider verticalCenter=191 horizontalCenter=0 minimum=0
  maximum=200 id=max liveDragging=true change=updateFilter()
  value=200/
  mx:Label text=Min textAlign=right width=117
  horizontalCenter=-147 verticalCenter=-191/
  mx:Label text=Max textAlign=right width=117
  horizontalCenter=-147 verticalCenter=191/--
 
  mx:HSlider horizontalCenter=0 verticalCenter=-200 id=priceSlider
  minimum=0
  maximum=300 tickInterval=10 snapInterval=10
  thumbCount=2 values=[0,300] tickColor=#ff
  labels=[$0k,$300M] liveDragging=true width=182
  change=updateFilter()/
 
  /mx:Application
 
 
  On Thu, Aug 7, 2008 at 2:39 AM, Tim Hoff [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;
   }
  
   priceSlider.values[300] doesn't exist. Then as Alex suggests, walk
   through the code with the debugger, or trace.
  
   -TH
  
   --- In flexcoders@yahoogroups.com, Tim Hoff TimHoff@ wrote:
   
   
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 dznuts@ wrote:

 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 myFilterFunction(item : Object) : Boolean
 {
 return item.value =
 Math.min(priceSlider.values[0],priceSlider.values[1])  item.value
   =
 Math.max(priceSlider.values[0],priceSlider.values[1]);
 }


 On Wed, Aug 6, 2008 at 5:29 PM, stinasius stinasius@ wrote:

  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
  change=filterGrid()/
 
 
  
 
  --
  Flexcoders Mailing List
  FAQ:
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
  Search Archives:
  http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo!
Groups
  Links

Re: [flexcoders] Re: filtering a flex datagrid using a slider with two thumbs

2008-08-06 Thread Josh McDonald
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 (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 =
 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
 =priceSlider.values[1);

 -TH





-- 
Therefore, send not to know For whom the bell tolls. It tolls for thee.

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]


[flexcoders] Re: filtering a flex datagrid using a slider with two thumbs

2008-08-06 Thread Tim Hoff
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 flexcoders@yahoogroups.com, Josh McDonald [EMAIL PROTECTED] wrote:

 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 (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 =
  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
  =priceSlider.values[1);
 
  -TH
 
 
 
 
 
 -- 
 Therefore, send not to know For whom the bell tolls. It tolls for 
thee.
 
 :: Josh 'G-Funk' McDonald
 :: 0437 221 380 :: [EMAIL PROTECTED]





Re: [flexcoders] Re: filtering a flex datagrid using a slider with two thumbs

2008-08-06 Thread Josh McDonald
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, which may momentarily annoy the user if he
grabs the max thumb first and tries to set it to 800... A trivial thing,
however!

On Thu, Aug 7, 2008 at 9:35 AM, Tim Hoff [EMAIL PROTECTED] wrote:

 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






-- 
Therefore, send not to know For whom the bell tolls. It tolls for thee.

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]


[flexcoders] Re: filtering a flex datagrid using a slider with two thumbs

2008-08-05 Thread stinasius
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 function please help me

public function filterGrid():void{
 dataAr.filterFunction=cityFilter;
 dataAr.refresh();
 //dgrid.selectedIndex = null;  
 }
 
 public function cityFilter(item:Object):Boolean{
 var result:Boolean=false;

 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; 
 } 

thanks in advance 



[flexcoders] Re: filtering a flex datagrid using a slider with two thumbs

2008-08-05 Thread Tim Hoff

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 eliminating all of the items.

-TH

--- In flexcoders@yahoogroups.com, stinasius [EMAIL PROTECTED] wrote:

 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 function please help me

 public function filterGrid():void{
 dataAr.filterFunction=cityFilter;
 dataAr.refresh();
 //dgrid.selectedIndex = null;
 }

 public function cityFilter(item:Object):Boolean{
 var result:Boolean=false;

 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;
 }

 thanks in advance






[flexcoders] Re: filtering a flex datagrid using a slider with two thumbs

2008-08-05 Thread stinasius
hi my price ranges are between 0 and 3,000,000 so should my max value
be 3,000,000 or 1? thanks



[flexcoders] Re: filtering a flex datagrid using a slider with two thumbs

2008-08-05 Thread Tim Hoff

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





[flexcoders] Re: filtering a flex datagrid using a slider with two thumbs

2008-08-05 Thread stinasius
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();
 //dgrid.selectedIndex = null;  
 }
 
 public function cityFilter(item:Object):Boolean{
 var result:Boolean=false;

 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[300])
 ){
 result=true; 
 } 
 return result; 
 } 



RE: [flexcoders] Re: filtering a flex datagrid using a slider with two thumbs

2008-08-05 Thread Alex Harui
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 datagrid using a slider with
two thumbs



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();
//dgrid.selectedIndex = null; 
}

public function cityFilter(item:Object):Boolean{
var result:Boolean=false;

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[300])
){
result=true; 
} 
return result; 
} 



 


[flexcoders] Re: filtering a flex datagrid using a slider with two thumbs

2008-08-05 Thread stinasius
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?



RE: [flexcoders] Re: filtering a flex datagrid using a slider with two thumbs

2008-08-05 Thread Alex Harui
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: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of stinasius
Sent: Tuesday, August 05, 2008 10:43 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: filtering a flex datagrid using a slider with
two thumbs



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?



 


[flexcoders] Re: filtering a flex datagrid using a slider with two thumbs

2008-08-05 Thread stinasius
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



[flexcoders] Re: filtering a flex datagrid using a slider with two thumbs

2008-08-04 Thread Michael VanDaniker
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 values of slider.  The
ICollectionView livedocs page should help you set up the filter function.

--- In flexcoders@yahoogroups.com, stinasius [EMAIL PROTECTED] wrote:

 hi guys i am tring to filter a datagrid with a price column using a
 slider that gets results which are btn two ranges min and max, can
 someone please help me. thanks





[flexcoders] Re: filtering a flex datagrid using a slider with two thumbs

2008-08-04 Thread stinasius
hi am fairly new to flex. if you dont mind maybe you could post some
small example on how to do it. thanks



[flexcoders] Re: filtering a flex datagrid using a slider with two thumbs

2008-08-04 Thread Michael VanDaniker
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 changes.  Your
filterFunction will look something like this...

private function processFilter(item:Object):Boolean
{
  return item.value  slider.values[0]  item.value  slider.values[1];
}

I hope this helps.


--- In flexcoders@yahoogroups.com, stinasius [EMAIL PROTECTED] wrote:

 hi am fairly new to flex. if you dont mind maybe you could post some
 small example on how to do it. thanks