Ryan
Ryan

Reputation: 301

The control manages the rows aggregation. The method "addRow" cannot be used programmatically

I have a table that I want to distinguish between the items in the table by checking some condition and if the condition holds, i want to add row. but when I try to do that I get the error that: The control manages the rows aggregation. The method "addRow" cannot be used programmatically!

var oTable = new sap.ui.table.Table({
        width : "900px",
        visibleRowCount : 10,
        navigationMode : sap.ui.table.NavigationMode.Paginator
    });
oTable.addColumn(new sap.ui.table.Column({
            label : new sap.ui.commons.Label({
                text : "Names"
            })
        }));
        $.each(data, function(index,
                nodes) {
            if (nodes == something) {
                oRow = new sap.ui.table.Row();
                oRow.addCell(new sap.ui.commons.Link({
                    text : "something"
                }));
                oTable.addRow(oRow);
            };
        });
    };

Upvotes: 1

Views: 2049

Answers (1)

cevou
cevou

Reputation: 325

You cannot add data manually to the sap.ui.table.Table. This has to be done using databinding. Please check the examples in the documentation:

https://openui5.hana.ondemand.com/#test-resources/sap/ui/table/demokit/Table.html

you can find more information on data binding here:

https://openui5.hana.ondemand.com/#docs/guide/91f0ca956f4d1014b6dd926db0e91070.html

Upvotes: 2

Related Questions