Nevermind...I got it working with this...
[unless there is a more elegant way?]
keyUp="myKeyUpHandler(event)"
public function myKeyUpHandler(event:KeyboardEvent):void
{
if (!event.ctrlKey && !event.shiftKey)
{
filterSelected();}
}
public function filterSelected():void {
riskDP.filterFunction = processSelectedFilter;
riskDP.refresh();
}
public function processSelectedFilter(item:Object):Boolean {
var result:Boolean=false;
for ( var i:String in riskDG.selectedItems) {
if(item.Number == riskDG.selectedItems[i].Number){
result = true;
}
}
return result;
}
--- In [email protected], "Don Kerr" <[EMAIL PROTECTED]> wrote:
>
> How do I allow the user to select multiple rows (by holding down CTRL
> or SHIFT) and when they are done making selections, fire an event to
> execute a filterfunction within the same ADG?
>
> I'm trying to allow the user to filter down a grid data to only show
> all the rows they just selected.
>
> With the ADG selectmode=multipleRows and allowMultipleSelection =true,
> this works fine in the ADG without the event.
>
> If I use the change event, it filters the data down to only the first
> row selected. I need it to wait until all row selections are made...so
> change doesn't appear to be the correct event to use.
>
> I've tried the ADG's keyUp KeyboardEvent
>
> keyUp="myKeyUpHandler(event)"
>
>
> public function myKeyUpHandler(event:KeyboardEvent):void
> {
> if (event.ctrlKey || event.shiftKey)
> {
> filterSelected();
> }
>
> But, event.ctrlKey being released always traces as false and it never
> runs my filter???
>
> Is using the keyboardevent on keyup the best way to do this? Why
> doesn't it detect ctrlKey or shiftKey release?
>
> I thought there might be a built-in ADG way to filter down a
> dataProvider to only show the selected rows. Don't know.
>
> In my case, The user runs reports but wants to only show selected
> items in the report. My filter below works, but I need to pass all
> selectitems items to it when the user is done.
>
> Any suggestions?
> Thanks,
> Don
>
>
> public function filterSelected():void {
> riskDP.filterFunction = processSelectedFilter;
> riskDP.refresh();
> }
> public function processSelectedFilter(item:Object):Boolean {
>
> var result:Boolean=false;
> for ( var i:int=0; i <
> riskDG.selectedItems.length; i++ ) {
> if(item.Number ==
> riskDG.selectedItems[i].Number){
> result = true;
> }
> }
> return result;
>
> }
>