Closed PerplexedFox closed 4 years ago
Hi, the API currently does not support resizing a column automatically based on the width of its content as it is out of the original scope. My hope is to be able to figure out the best way to do this.
Until then you'll have to decide what width you'd like for your columns and specify the width by opting out of automatic width calculation and using the widthForColumnAt
delegate method.
Hi, thank you for the answer. The biggest issue I have is that this resizing works seemingly at random so that many headers are cropped, while others made very wide. Do you have any idea why the cropping occurs?
You've already raised this in a new issue which is the correct way to go about this. We can leave this issue open for the colouring issue.
You mentioned highlighting rows after sorting, could you please explain what you expect in regards to your row colouring?
Rows are colouring as expected. If you have a different expectation please outline how you'd like to interface with the library and what coloring feature you would like to see.
Hi, thanks for your answer.
Since I may not share my project, I created a new one with two view Controllers but the same data. You can find it here: https://github.com/PerplexedFox/SwiftDataTables_minEx
You will find the example of the color delegate function problem(func dataTable(_ dataTable: SwiftDataTable, unhighlightedColorForRowIndex at: Int) -> UIColor
and func dataTable(_ dataTable: SwiftDataTable, highlightedColorForRowIndex at: Int) -> UIColor
) I described above
for the following code
this is the result
Got it.
in
public func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
let cellViewModel = self.rowModel(at: indexPath)
if cellViewModel.highlighted {
cell.contentView.backgroundColor = delegate?.dataTable?(self, highlightedColorForRowIndex: indexPath.item) ?? self.options.highlightedAlternatingRowColors[indexPath.section % self.options.highlightedAlternatingRowColors.count]
}
else {
cell.contentView.backgroundColor = delegate?.dataTable?(self, unhighlightedColorForRowIndex: indexPath.item) ?? self.options.unhighlightedAlternatingRowColors[indexPath.section % self.options.unhighlightedAlternatingRowColors.count]
}
indexPath.item must be replaced by indexPath.section
Hi,
I need a way to fixedly highlight one row (depending on data, do that after sorting the right row is still highlighted) So I implemented the delegate functions
and
however, instead of alternating rows (horizontally), these methods color the whole columns!
Can you fix it?