and this is how I set my initial DP back to normal

private function clearSearch():void{
itemsDiscontinued = new ListCollectionView(regions);
               itemsDiscontinued.filterFunction = null
               itemsDiscontinued.refresh();
               myGrid.dataProvider = itemsDiscontinued;
          }

// itemsDiscontinued = new ListCollectionView(regions); is set to the intial DP... which would be your xml data

Jeremy


Jeremy Tooley wrote:

Dude,

I just fought this battle. I had an Array Collection and I would filter it.. but the I couldnt access the indexs of the arrayCollection. It would only change my dataGrid and comboboxes based on what was in the view.

Here is my code snip

//import the class first
import mx.collections.ListCollectionView;
// you can then use this later..... to me I store my intial data in it without changing my dataProvider

private function checkBoxFilter():void{
                  // regions is my DP... can be xml or arrayCollection
                 listMyFavorites = new ListCollectionView(regions);
// I check against the item to see if its true..... but I never change the original DP listMyFavorites.filterFunction = function (item:Object):Boolean {return String(item.var1) == "assets/blueStar.png"};
                listMyFavorites.refresh();
// update my datagrid.. but it is not reflective on my original DP.. as my ListCollectionView just took over that duty
                myGrid.dataProvider = listMyFavorites;
// dont want sorting after the function has played out.. so I null it
                listMyFavorites.filterFunction = null
}

All I know is ListCollectionView stores the stuff for me while I am in the application.... and changes things based on my inital dp.

This functionality rocks.
If you were filtering your initial DP... you could trace it and it would all show up fine.... but come to use it and your screwed

so use the ListCollectionView

Jeremy

tdexterus wrote:

Hi All
I have a relatively simple template, we are using XML data generated
and embedded into the template. The template has a combo box that is
initialized upon opening the template - it has a list of Departments
+ 'All'. The user can change the combo choice, the XML is filtered
and a chart and table are refreshed with the same data.
All is fine except when the user comes back to 'All' ... nothing is
rendered as if no data is returned. I have debugged and the code is
returning all XMLdata:
Code snippet
private function getEmployees(deptVal:String):void
{
if (deptVal == 'All')
{
// we want the complete data set again so use empty filter
EmpTable.dataProvider = dataXML.ROW.(DEPARTMENT_NAME != null);
deptChart.dataProvider = dataXML.ROW.(DEPARTMENT_NAME != null);
}
// Combo box selection has been made so filter by Deprtment
EmpTable.dataProvider = dataXML.ROW.(DEPARTMENT_NAME ==
deptVal);
deptChart.dataProvider = dataXML.ROW.(DEPARTMENT_NAME == deptVal);
}

Any ideas why the All option is not refreshing the output, I have
tried variations on this theme. Is there a method to force a refresh
of the components ?
Thanks for any help, Tim

------------------------------------------------------------------------

No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.7/711 - Release Date: 3/5/2007 9:41 AM


------------------------------------------------------------------------

No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.7/711 - Release Date: 3/5/2007 9:41 AM

Reply via email to