Skip to Content

How to implement FUIGridTableViewCell with FUIGridTableViewHeader

Hi,

I am trying to implement FUIGridTableViewCell with FUIGridTableViewHeader using below link with SAP iOS SDK :

https://help.sap.com/doc/978e4f6c968c4cc5a30f9d324aa4b1d7/2.0/en-US/Documents/Frameworks/SAPFiori/gridtableview.html

But I am getting error on below line. Please help me.

I need to implement Grid view or Table view with header.

 let data = contentData[indexPath.row] {
        cell.gridItems = data.gridItems
}

let header = tableView.dequeueReusableHeaderFooterView(withIdentifier: FUIGridTableViewHeader.reuseIdentifier) as! FUIGridTableViewHeader
        header.gridItems = headerData.gridItems
Add a comment
10|10000 characters needed characters exceeded

  • Ruchi Shree My guess is that you have not registered the FUIGridTableViewHeader class as a header/footer view on the table view?

    Can you try using the UITableView API:

    func register(_ aClass: AnyClass?, forHeaderFooterViewReuseIdentifier identifier: String)

    If this doesn't help, can you share the details of your error?

  • I have registered tableview with FUIGridTableViewHeader

    tableView.register(FUIGridTableViewHeader.self, forHeaderFooterViewReuseIdentifier: FUIGridTableViewHeader.reuseIdentifier)

    I followed steps mentioned in portal https://help.sap.com/doc/978e4f6c968c4cc5a30f9d324aa4b1d7/2.0/en-US/Documents/Frameworks/SAPFiori/gridtableview.html

    still i am getting error is

    Value of type 'FUIGridRowItem' has no member 'gridItems'. Is there some other api to set data for Grid cell.

  • Hi Folks,

    I tried to implement FUIGridTableViewHeader using below code, but still table view header is not appearing on screen.

    tableView.sectionHeaderHeight = UITableView.automaticDimension

    tableView.estimatedSectionHeaderHeight = 100

    tableView.register(FUIGridTableViewHeader.self, forHeaderFooterViewReuseIdentifier: FUIGridTableViewHeader.reuseIdentifier)

    override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {

    let header = tableView.dequeueReusableHeaderFooterView(withIdentifier: FUIGridTableViewHeader.reuseIdentifier) as! FUIGridTableViewHeader

    var headerData: [FUIGridRowItem] {

    let item0 = FUIGridRowHeaderItem(text: "1")

    let item1 = FUIGridRowHeaderItem(text: "Symbol")

    let item2 = FUIGridRowHeaderItem(text: "Open")

    let item3 = FUIGridRowHeaderItem(text: "High")

    let item4 = FUIGridRowHeaderItem(text: "Low")

    let item5 = FUIGridRowHeaderItem(text: "Close")

    return [item0, item1, item2, item3, item4, item5]

    }

    // set column widths.Should be shared by rows and header.

    header.items = headerData

    header.columnWidthPercent = [-1, 0.2, 0.1, 0.1, 0.1, 0.1]

    return header

    }

    Could you please help me , did i miss anything?

Related questions

1 Answer

  • Posted on Mar 03 at 10:13 PM

    Bill Zhou can you look?

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.