Showing posts with label filter. Show all posts
Showing posts with label filter. Show all posts

Thursday, January 28, 2010

DataGrid with client-side filtering and searching

MDataGrid can be used just like standard DataGrid: you define a dataProvider and columns either in MXML or in ActionScript. If you want a column to allow filtering replace DataGridColumn with MDataGridColumn which by default has a text wildcard filtering enabled. If you prefer to filter column in a different way change filterEditor property of the column to point to some filter editor from com.iwobanas.controls.dataGridClasses.filterEditors package. You can find more information in the ASDoc in the source code.

source: http://www.iwobanas.com/2009/06/datagrid-with-client-side-filtering-and-searching/

Wednesday, December 12, 2007

AutoFilter Search in Flex

Actual post: AutoFilter Search in Flex
It might be really easy to search a list if you implement this feature.
This is how it is done

private var filteredListArray : Array;

private function filterList(event:Event = null) : void
{
var txtLength:Number = txtInput.length;;
var txtEntered:String = txtInput.text;
filteredListArray = new Array();

if(txtInput.text == “”)
{
listId.dataProvider = dataProvider;
return;
}

else
{
for(var i : int = 0 ; i < dataProvider.length; i++)
{
if(dataProvider[i].toString().substring(0, txtLength).toLowerCase() == txtEntered.toLowerCase())
{
filteredListArray.push(dataProvider[i]);
}
listId.dataProvider = filteredListArray;
}
}

}




TextInput calls filterList(event) every time user inputs something in the text input box
filterList(event) method carries out all the necessary functionality

Freelance