FUIDataTableModel

public class FUIDataTableModel

FUIDataTableModel is the data structure being used in FUIDataTable view.

Code Usage:

let header = FUITableRowItem(leadingAccessories: [], trailingAccessory: nil, data: titles)
let model = FUIDataTableModel(headerData: nil,
                              rowData: rowData,
                              isHeaderSticky: true,
                              isFirstColumnSticky: true,
                              columnAttributes: columnAttributes,
                              rowAlignment: .top,
                              isPinchZoomEnable: false,
                              showRowDivider: true,
                              showColoumnDivider: true,
                              headerCellPadding: UIEdgeInsets(top: 8, left: 16, bottom: 8, right: 16),
                              dataCellPadding: UIEdgeInsets(top: 16, left: 16, bottom: 16, right: 16),
                              minRowHeight: 48,
                              minColumnWidth: 48,
                              allowsPartialRowDisplay: true,
                              backgroundColor: .white,
                              showListView: false)
model.didSelectRowAt = { _ in
print(model.selectedIndexes)
}
  • FUITableRowItem, header data for displaying.

    Declaration

    Swift

    public var headerData: FUITableRowItem? { get set }
  • Data for each row.

    Declaration

    Swift

    public var rowData: [FUITableRowItem] { get set }
  • Switching between normal and editing mode.

    Declaration

    Swift

    public var isEditing: Bool { get set }
  • Set header to be sticky.

    Declaration

    Swift

    public var isHeaderSticky: Bool { get set }
  • Set first column to be sticky.

    Declaration

    Swift

    public var isFirstColumnSticky: Bool { get set }
  • Set horizontal scrolling.

    Declaration

    Swift

    public var horizontalScrolling: Bool { get set }
  • Show list view in iPhone protrait mode.

    Declaration

    Swift

    public var showListView: Bool { get set }
  • Enable or disable pinch and zoom.

    Declaration

    Swift

    public var isPinchZoomEnable: Bool { get set }
  • show or hide row dividers

    Declaration

    Swift

    public var showRowDivider: Bool { get set }
  • show or hide first column divider

    Declaration

    Swift

    public var showColoumnDivider: Bool { get set }
  • custom header cell’s padding; if set it overwrites default value

    Declaration

    Swift

    public var headerCellPadding: UIEdgeInsets? { get set }
  • custom data cell’s padding; if set it overwrites default value

    Declaration

    Swift

    public var dataCellPadding: UIEdgeInsets? { get set }
  • min row height

    Declaration

    Swift

    public var minRowHeight: CGFloat { get set }
  • min column width

    Declaration

    Swift

    public var minColumnWidth: CGFloat { get set }
  • whether allows to display partial row; For Table Card, set this to false

    Declaration

    Swift

    public var allowsPartialRowDisplay: Bool { get set }
  • background color

    Declaration

    Swift

    public var backgroundColor: UIColor { get set }
  • Column attribute for each column.

    Declaration

    Swift

    public var columnAttributes: [FUITableColumnAttribute] { get set }
  • row alignment

    Declaration

    Swift

    public var rowAlignment: FUIDataTableRowAlignment { get set }
  • Selection did change handler.

    Declaration

    Swift

    public var didSelectRowAt: ((_ index: Int) -> Void)? { get set }
  • Selected Indexes.

    Declaration

    Swift

    public var selectedIndexes: [Int] { get set }
  • Public initializer for FUIDataTableModel.

    Declaration

    Swift

    public init(headerData: FUITableRowItem? = nil,
                rowData: [FUITableRowItem] = [],
                isHeaderSticky: Bool = false,
                isFirstColumnSticky: Bool = false,
                columnAttributes: [FUITableColumnAttribute] = [],
                rowAlignment: FUIDataTableRowAlignment = .top,
                isPinchZoomEnable: Bool = false,
                showRowDivider: Bool = true,
                showColoumnDivider: Bool = true,
                headerCellPadding: UIEdgeInsets? = nil,
                dataCellPadding: UIEdgeInsets? = nil,
                minRowHeight: CGFloat = 48,
                minColumnWidth: CGFloat = 48,
                allowsPartialRowDisplay: Bool = true,
                backgroundColor: UIColor = UIColor.preferredFioriColor(forStyle: .secondaryGroupedBackground),
                showListView: Bool = false)

    Parameters

    headerData

    Header data for displaying.

    rowData

    Data for each row.

    isHeaderSticky

    Set header to be sticky.

    isFirstColumnSticky

    Set first column to be sticky.

    columnAttributes

    Column attribute for each column.

    rowAlignment

    Row alighnemt

    isPinchZoomEnable

    Set if pinch and zoom enble, the default is false.

    showRowDivider

    Show or hide row dividers

    showColoumnDivider

    Show or hide first column divider

    headerCellPadding

    Custom header cell’s padding

    dataCellPadding

    Custom data cell’s padding

    minRowHeight

    Min row height

    minColumnWidth

    Min column width

    allowsPartialRowDisplay

    Whether allows to display partial row; For Table Card, set this to false

    backgroundColor

    background color

    showListView

    Show list view in iPhone protrait mode