mikecsh / mbtablegrid

An NSControl subclass which provides a spreadsheet-style table grid
45 stars 17 forks source link

Handling empty grids and changes to the number of rows & columns #9

Open ghost opened 10 years ago

ghost commented 10 years ago

I’ve created a branch called ‘emptytable’ with some changes to MBTableGrid so that it is able to handle empty grids and changes to the number of rows & columns, especially when rows & columns are removed.

Comments are welcome.

One thing that I think we should do is to review selected{Row,Column}Indexes for no selection. I see there’s code that assumes that -firstIndex and -lastIndex are always valid, but that’s not the case when we have an empty grid. In -[MBTableGrid initWithFrame:], these index sets default to index 0. Should we change them to empty sets and review all code that uses them?

ghost commented 10 years ago

Another option regarding empty selection indexes: if there is at least one cell, force at least one selected row and one selected column—this matches current behaviour. Selected row (column) indexes are empty if and only if there are no rows (resp. columns), so any method that inspects -firstIndex or  -lastIndex only needs to make sure that the grid is not empty.

I’ll work on implementing this throughout the code base in the emptytable branch.

ghost commented 10 years ago

I believe the emptytable branch is ready to be merged into master, but I could definitely use more eyes. I’ll wait for two weeks before merging.

mikecsh commented 10 years ago

Hi, I can take a look at this in the first week of June - sounds excellent!

ghost commented 10 years ago

Midweek ping!

DivineDominion commented 8 years ago

Pinging for news :)

mikecsh commented 8 years ago

@bavarious @DivineDominion Hi both, I'm afraid I no longer have any free time to spend on mbtablegrid, especially considering I'm not using it in any apps. My suggestion would be to use either one of the much more advanced and maintained forks from @brendand or @pixelspark - good luck!