Ever wanted to have a ComboBox on datagrid header to filter the datas?
Most of the results found on net were disappointing. Since they just provided a solution to place the ComboBox on datagrid header. The basic step was to override the setter function data in ComboBox class which is intended to be the DataGridHeader Renderer
override public function set data(value:Object):void
{
if(value is DataGridColumn)
{
//Don't do anything
}
else
{
super.data = value
}
}
Unfortunately, it didn’t really work well. The values in ComboBox never remained the selected once after it was sorted. After digging in to the main classes I came up with a solution.
Download source
Thanks dude. You saved my time.
good work there!
Hi
I’m impressed with your code! good job! I want to do the exact same thing but I have advancedatagrid instead of datagrid and want to have checkboxes in my combobox and the user is allowed to choose more than one checkbox, so there will be a button in the combobox too. The event will be triggered on the button after the user selects some checkboxes!
I made this using another code that I found online, but the filtering was not working on the groups! (User is allowed to create summaries and grouping in my UI), so when I apply filter on the groups it shows me emply colums. The filtering is working on the groups with your code though! any suggestions how I can filter using checkboxes, using your code?
Thanks
Golnoosh
Hi Golnoosh,
Update the class com.fb.controls.renderers.LibraryTypesHeaderRenderer to have CheckBoxes in it like you had in your previous code.
Once the event is dispatched, its caught inside the function “handle_Change” defined in the class com.fb.controls.LibraryTypesHeaderColumn. Update the class com.fb.events.LibraryTypeEvent to hold your filter records and then use the function allDocFilter defined in the class DataGridHeader to filter records based on your choice. Give things a try.
Happy Coding
Thanks!Good job!
Thanks. It works great. All I need now is to figure out how to use create different comboboxs for each header.
Any thoughts is appreciated.
Thanks again!!
Michael Lindvall
is it possible to provide combo box filter and sorting in one column?
Hello, good work.
Now i´m trying to do the same thing as mLindvall, i´m trying to use different combobox for each header, and i´m trying to do the same thing as the “MS Excel auto filter function”.. if anyone succeed doing that, please let me know.
Thank you!
Hi, I will check that one out when I get some time..
Happy Coding..