Reputation: 151
I am using XML views to create views in my SAPUI5 project. I was trying to implement factory functions to use for Columns & Rows of a sap.ui.Table control. Column factory seems to be working fine but for some reason Row factory never gets executed.
View:
<table:Table xmlns:table="sap.ui.table"
columns="{
path: 'oModel>/columns',
factory: '.colFactory'
}"
rows="{
path: 'oModel>/rows',
factory: '.rowFactory'
}"
>
<!-- ... -->
</table:Table>
Controller:
// Column required from "sap/ui/table/Column"
// Row required from "sap/ui/table/Row"
colFactory: function(sId, oContext) {
// ...
return new Column({/*...*/});
},
rowFactory: function(sId, oContext) {
// ...
return new Row({/*...*/});
},
I have implemented a dynamic binding of both Rows
and Columns
as per a specific requirement. Can someone please suggest or help me here? Can get my head around thinking what is missing or wrong.
Upvotes: 1
Views: 1984
Reputation: 18044
The use of factory
function is intentionally left out for sap.ui.table.Table
in order to deal with huge amounts of data in contrast to sap.m.Table
. The grid table (sap.ui.table.Table
) reuses its existing DOM element when the user scrolls, which is incompatible with how factory functions work.
If you really need to use a factory
function, I'm afraid there is no other way than implementing sap.m.Table
instead (although the performance will suffer). If not, define templates in the Column controls.
Please review also the documentation topic Tables: Which One Should I Choose?
Upvotes: 1