Pregunta

My requirement is something like that,

On top of NSOutlineview there would be a search textfield and NSOutline view may contains the nested Groups,

if a item / row is matching with the search query, then it should be displayed, which its all parent node till root level,

the way i am doing is as follows,

1 -- Depending upon the what user has entered , re-building tne NSOutlineview datasource ( Nothing but an NSArray )

2 -- Have implemented all delegate method,

Now my problem is Group is not getting expanded automatically, I know i should call

-expandItem:expandChildren:,

but my questions is from where i should call this, i called it after reload data but it didn't work

i tried to call it something like this ,,,,

- (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)aTableColumn byItem:(id)item {
    if(aTableColumn == nil){
        [self log:@"aTableColumn is NIL "];
        return nil;
    }   
    if([[aTableColumn identifier] isEqualToString:@"firstColumn"] ){
        if ( [myOutlineView shouldExpandIt:item]){
            [myOutineView expandItem:item];
        }
        return item;
    }
    return item;
}

but its faulting perhaps going to recursive loop

Any other way to achieve the same.

¿Fue útil?

Solución

Thanks to all of you to look into this,

By putting log, i found out to be , it seems to be [NSOutlineView reloadData ] seems to be blocking call,

so after that if i need to expand / collapse group , i am using

  [pCTOutlineView expandItem:pValue];

and working so far....

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top