cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

Hello UI5 Gurus,

In my view I have a table created using sap.ui.table library , I have given it a custom id "TAB2"

Now in my controller side I have written code for Downloading Table control data, I have attached screenshot.

I am getting Excel file downloaded , but its with empty contents.

Can anyone please suggest, what needs to be rectified.

Thanks,

Sijin

0 Likes
View Entire Topic
Ivan-Mirisola
Product and Topic Expert
Product and Topic Expert
0 Likes

Hi Sijin,

Table objects are tricky. Have you tried this:

var oTable = this.getView().byID("TAB2");
// oTableRows will contain the visible data on your table in json format - so you can pass it to the sap.ui.core.util.ExportTypeCSV
var oTableRows = oTable.getBindingInfo("rows");

This is just the beginning of it. I had to develop an utility library to be able to export data. That is because the view component (table) will contain only the displayed values. If you perform filters, or sorters of any kind, your export will be useless. Let's say you limit the table to 5 rows. Your export will have just 5 rows.

The correct solution should be to base your export function on what the full OData output. So you need to retrieve the filters, sorters and selected columns to "mimic" the data the user "thinks" they are seeing and then call the service again passing the values back to the export functionality.

Regards,
Iivan

0 Likes

Hi Ivan,

i agree to your point of view in calling the odata service to download the data in excel. does this can be achieved to the sap.ui.table/ grid table in the object page table?

I have to enable download button in object page section- table data in object page with fiori version 1.52.

is this possible?

thanks,

Soumya