Best way to programatically set column width in a ShinobiGrid?


#1

I looked through the API and came up short. Is it the case that you’re supposed to change the cell.frame in the cell returned from "- (SGridCell *)shinobiGrid:(ShinobiGrid *)grid cellForGridCoord:(constSGridCoord *) gridCoord" in the SGridDataSource?


#2

Hi James,

To set the width of the columns in your grid you can use an SGridColRowStyle object. You can create one like this:

// Somewhere in your interface
SGridColRowStyle *_myColumnStyle;

...

// Somewhere in your constructor or viewDidLoad
_myColumnStyle = [SGridColRowStylenew];
[_myColumnStyle setSize:[NSNumber numberWithInt:DESIRED_COLUMN_WIDTH]];

...

// Return the style here. You can return different styles with different widths for a column based on the colIndex value.
-(SGridColRowStyle*)shinobiGrid:(ShinobiGrid *)grid styleForColAtIndex:(int)colIndex {
    return _myColumnStyle;
}

#3

Hi, 

I am new to Shinobi Grids and I have downloaded the trial version. We develop Enterprise applications on the Monotouch framework and currently I am evaluating the Shinobi Grid to be used as a “reporting tool” within our iPad applications. I am trying to find out whether is possible to configure a column to be autoresizable depending on the data currently shown. Is that possible?