jarmanje
09-28-2008, 07:19 PM
Hi there,
I have a search field when you click on search.
I want to make it so i can change which field in a datagrid you search for depending on the choice in the Combbox. I'm not sure how to set the object name correctly depending on the combobox selection.
I tried it like this, to no avail
private var acOrder:ArrayCollection
private var currentOrder:Object;
///////////////this is incorrect. What should i use instead of Object?//////
private var whichArray:Object
/////////////
private function makeid():void
{
whichArray = "orderid"
}
private function makeemail():void
{
whichArray = "email"
}
private function filterByOrderid(item:Object):Boolean
{
if (item.(whichArray) == filterTxt.text)
////I want this result to either be if (item.orderid == filterTxt.text)
///or if (item.orderid == filterTxt.email)
{
return true;
}
else
{
return false;
}
}
private function doFilter():void
{
if (filterTxt.text.length == 0)
{
acOrder.filterFunction = null
}
else
{
acOrder.filterFunction = filterByOrderid;
}
acOrder.refresh()
}
Thanks a lot for any help.
sorry for the very 'newbie' question!
I have a search field when you click on search.
I want to make it so i can change which field in a datagrid you search for depending on the choice in the Combbox. I'm not sure how to set the object name correctly depending on the combobox selection.
I tried it like this, to no avail
private var acOrder:ArrayCollection
private var currentOrder:Object;
///////////////this is incorrect. What should i use instead of Object?//////
private var whichArray:Object
/////////////
private function makeid():void
{
whichArray = "orderid"
}
private function makeemail():void
{
whichArray = "email"
}
private function filterByOrderid(item:Object):Boolean
{
if (item.(whichArray) == filterTxt.text)
////I want this result to either be if (item.orderid == filterTxt.text)
///or if (item.orderid == filterTxt.email)
{
return true;
}
else
{
return false;
}
}
private function doFilter():void
{
if (filterTxt.text.length == 0)
{
acOrder.filterFunction = null
}
else
{
acOrder.filterFunction = filterByOrderid;
}
acOrder.refresh()
}
Thanks a lot for any help.
sorry for the very 'newbie' question!