Parsing the Directories in TreeView structure in cocoa

237 Views Asked by At

I am trying to parse the Directories and its sub directories from the server. I need to display it in tree structure view. Now i am able to display them till three levels. May i know how to get the index of the parent node and child nodes in tree view. I am using NSOutlineView to display them in treeView. The problem I am facing is now getting the row index. If i click the second child of first parent that time i am getting the Third Parent value.

For listing the main directories: After Click the directory agin it will come to the same directory with sub directories array.

-(void)processSData:(NSArray*)data {

    NSString* str = @"";
     [btnNameArray removeAllObjects];
    for (NSDictionary* d in data)
    {
        str = [str stringByAppendingString:[self processDict:d]];

    }

    if(countDir ==0){
        Person *p ;
        if(tempFlag == 0)
        {
        for (int i = 0; i<btnNameArray.count; i++)
        {
            p = [[Person alloc]initWithName:[btnNameArray objectAtIndex:i]];
            [_dicName addObject:p];
            countDir=1;

        }
        [self.dirTreeList reloadData];
}

After select the folder it will go to:

- (IBAction)columnChangeSelected:(id)sender
{
    NSInteger selectedRow = [self.dirTreeList selectedRow];

    if(selectedRow!=-1)
    {
        [self dicRunAction:[tempArray objectAtIndex:selectedRow]];
    }
    else{

    }

}

enter image description here

Thanks.

0

There are 0 best solutions below