sarath chambayil
sarath chambayil

Reputation: 77

ADD A COLUMN WITH SR.NO in Sap.m.table irrespective of other columns

I have a sap.m.table which has content in it, i want to add a column in the same table with sr.no and it should increment and decrement automatically when data is added and deleted respectively.The number should be added dynamically as per the data in the table. can anyone suggest me good solution for this problem.

Upvotes: 1

Views: 1340

Answers (1)

Prashob Thekkyal
Prashob Thekkyal

Reputation: 400

Get your table's sPath from oContext...

For Example:

oTable.bindAggregation("items", {
            path: "/",      //json is an array of rows
            factory: function(sId, oContext) { //this function is applied to each row

                var sPathindex = oContext.getPath();
                var index = parseInt(sPathindex.substring(1))+1;

                var serialNo = new sap.m.Text({text: index });
            }
           return colListItem = new sap.m.ColumnListItem({
                    cells:[serialNo ]
           });
  }

Hope this will helps you to solve your problem

Upvotes: 1

Related Questions