Shinobi DataGrid column width and custom cell issue (1)


#1

Hi, I try not to post stupid questions, but I am about ready to throw the laptop out the window.

I have a datagrid with 3 columns, each column containing a custom cell class. the columns on the left and right are to be a fixed size, (40.0) and the middle column is to be the total grid width minus the 2 cap columns (in other words if the view is resized the middle column should expand/contract. But that isn’t the issue as I haven’t even been able to get to that aspect.)

So, even if I hard code the column widths (whether in my parent views’ initWithFrame or layoutSubviews) to match the initial width of the grid itself, I am still getting incorrect results. So say I set my widths, in this case right after creating and adding columns in init,

// default grid width = 280

openColumn.tag = 1;

openColumn.width = @40;
nameColumn.width = @200;
logColumn.width = @40;

Ok. So even checking the column width in  - (void)shinobiDataGrid:(ShinobiDataGrid *)grid prepareCellForDisplay:(SDataGridCell *)cell:

if (cell.coordinate.column.tag == 1)
    NSLog(@“cell.coordinate.column.width in prepareCellForDisplay: %@”, cell.coordinate.column.width); // returns 40

So far so good. Now logging my dimensions in my custom cell setFrame:

NSLog(@“frame WIDTH: %f”, frame.size.width); // returns 60

20 pixels more! WTF? I have turned off all themes and formatting trying to isolate this, but it is completely wrecking havoc on my layout. It seems like it should be really easy, but apparently the only thing we can control for a DataGrid column is the width (and minimumWidth) properties. It looks like there is the ability to resize via a shouldResize delegate, but I don’t want the user to be able to resize the width manually. I just want the stupid cell to stay at the width I set it at. It seems like some sort of auto layout is trying to take over or something.

So my apologies for such a stupid thing but I’m at the end of my rope on this.

Thank you

-Eric


#2

So of course once I make a post I figure it out (sorry for the double post BTW).

It appears that the default minimumWidth must be 60, and if the desired width is less than that, the minimumWidth must also be set. My apologies if that is in the documentation somewhere. Sigh.