Skip to Content
0

Freeze first column in sap.ui.table

Jan 10, 2017 at 10:53 AM

171

avatar image

Dear Experts,

I have an SAP UI5 app where the first column of a grid table should be frozen for mobile devices as per the requirement from a customer. For example - https://sapui5.hana.ondemand.com/explored.html#/sample/sap.ui.table.sample.TableFreeze/preview

But I'm unable to do it because the freezing property fixedColumnCount works only for the UI5 version 1.30 and above. How I know this is by giving the resources URL in index.html - https://sapui5.hana.ondemand.com/1.30.10/resources/sap-ui-core.js

Since the customer landscape for the moment has UI5 version 1.28.34 (planning to upgrade soon) the table is not working accordingly. Here's JS bin example of my app - https://jsbin.com/gokiveroxu/edit?html,js,console,output

Appreciate all the help.

Thanks and Regards,

Prerana

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Jun Wu Jan 10, 2017 at 01:53 PM
0

we are on 1.28, that property works for us at least for desktop.

Show 4 Share
10 |10000 characters needed characters left characters exceeded

Hi Jun Wu,

Thanks for the reply. It is not working for desktop either.To give you a glimpse of how it looks -

Is it maybe because I am adding CSS? I am adding the following code in window.setTimeout function -

var t = mycalendarView.byId("table");

t.setVisibleRowCount(t.getModel().oData.d.results.length);

for (var i = 0; i < t.getRows().length; i++) {

if (/^[a-zA-Z ]+$/.test(t.getRows()[i].getCells()[0].getContent()[0].getValue())) {

var cells = t.getRows()[i].getCells();

for (var j = 1; j < cells.length; j++) {

if (cells[j].sId.includes("input") || cells[j].sId.includes("Total")) {

cells[j].setEditable(false);

document.getElementById(cells[j].oParent.sId).setAttribute("style", "background-color:#F0F0F0");

}

}

}

}

The customer would like the rows to be in grey color which contains titles. Do you think this maybe the reason?

Thank you,

Prerana

grid-table.png (12.8 kB)
0

just remove your code to see if it works

0

Hi,

Tried. Didn't work. Could you perhaps please share how you did it?

Thanks.

0

Its not working. you see how the column is moving to the right? this screenshot is from jsbin example.

Thanks.

screenshot.png (20.0 kB)
0
Jun Wu Jan 11, 2017 at 03:44 AM
0

https://jsbin.com/ragoxefoga/1/edit?html,js,output

even your jsbin example is working, why you are saying it is not working?

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hi,

If you try to change the resources URL from https://sapui5.hana.ondemand.com/1.28.10/resources/sap-ui-core.js to https://sapui5.hana.ondemand.com/1.30.10/resources/sap-ui-core.js you will notice the change.

This issue is hindering project go live. Appreciate all your help.

Thanks.

0

tried, don't see any difference...

0