Quantcast
Channel: SCN : All Content - SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 6178

Problems with own tableRenderer - scrollbar not getting a correct ID

$
0
0

Hi,

 

sorry for bothering you guys again (still learning how to use SAPUI5). I am facing a problem when using my own tableRenderer. I got the following code:

 

       sap.ui.table.TreeTable.extend("test.uicontrol.table", {

            init: function () {

                sap.ui.table.TreeTable.prototype.init(this, arguments);

            },

        });

 

        test.uicontrol.tableRenderer = sap.ui.core.Renderer.extend(sap.ui.table.TreeTableRenderer);

 

        test.uicontrol.tableRenderer.renderTableCell = function (rm, oTable, oRow, oCell, iCellIndex, bFixedTable, iStartColumn, iEndColumn) {

            var iColIndex = oCell.data("sap-ui-colindex");

            var oColumn = oTable.getColumns()[iColIndex];

            if (oColumn.getVisible() && !oColumn.getGrouped() && iStartColumn <= iColIndex && iEndColumn > iColIndex) {

                rm.write("<td");

                var sId = oRow.getId() + "-col" + iCellIndex;

                rm.writeAttribute("id", sId);

                if (oTable._bAccMode) {

                    // correct would be aria-labelledby but doesn't work for JAWS

                    rm.writeAttribute("headers", oTable.getId() + "_col" + iColIndex);

                    rm.writeAttribute("role", "gridcell");

                    rm.writeAttribute("aria-labelledby", oTable.getId() + "-ariadesc " + oColumn.getId() + " " + oCell.getId());

                    rm.writeAttribute("aria-describedby", oTable.getId() + "-toggleedit");

                    rm.writeAttribute("aria-activedescendant", oCell.getId());

                    rm.writeAttribute("tabindex", "-1");

                    if (oTable.getSelectionMode() === sap.ui.table.SelectionMode.Multi) {

                        rm.writeAttribute("aria-selected", "false");

                    }

                }

                var sHAlign = this.getHAlign(oColumn.getHAlign(), oTable._bRtlMode);

                if (sHAlign) {

                    rm.addStyle("text-align", sHAlign);

                }

                rm.writeStyles();

                if (iCellIndex === 0) {

                    rm.addClass("sapUiTableTdFirst");

                }

                rm.writeClasses();

                rm.write("><div");

                rm.addClass("sapUiTableCell");

                // rm.addStyle('color', '#000000');

                rm.writeStyles();

                rm.writeClasses();

                rm.write(">");

 

                this.renderTableCellControl(rm, oTable, oCell, iCellIndex);

 

                rm.write("</div></td>");

            }

        };

 

I am using the following code to add a table which is an instance of test.uicontrol.table

 

        var oTable = new test.uicontrol.table(viewData.idTreeTable, {

            columns: addColumns,

            selectionMode: sap.ui.table.SelectionMode.Double,

            allowColumnReordering: true,

            expandFirstLevel: false,

            rowHeight: 23,

            columnHeaderHeight: 23,

            fixedColumnCount: 1,

            selectionMode: sap.ui.table.SelectionMode.Single,

            enableColumnReordering: true,

            showColumnVisibilityMenu: true,

            width: "50%",

            toggleOpenState: function (oEvent) {

                this.rerender();

            }

        });

 

Basically, this works. The problem is, that the vertical scrollbar used in the table is not getting a correct ID. Instead of something like "__table1-vsb" the ID is set to "undefined-vsb" which again leads to an error when adding another table (Error: adding element with duplicate id 'undefined-vsb').

 

Thanks for your kind support in advance!

 

Bye

   Christian


Viewing all articles
Browse latest Browse all 6178

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>