title: Reading column index of selected table row in UI5 application
body: <p>I want to read column index of user selected row in a <code>sap.m.Table</code>. I tried few ways during debugging but not working. I am able to get the columns but not it's index.</p>
  
  <p>Please find the table output screenshot attached below where I need to capture the table header(quarter name) when user selected any value.</p>
  
  <p><a href="https://i.stack.imgur.com/I3t9j.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/I3t9j.png" alt="enter image description here"></a> </p>
  
  <p><strong>header.controller.js</strong> </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>sap.ui.define([
   "sap/ui/core/mvc/Controller",
   "sap/ui/model/Filter",
   "NPAWRMA/model/formatter",
   "sap/ui/model/FilterOperator"
  ], function(Controller, Filter, formatter, FilterOperator) {
   "use strict";
  
   return Controller.extend("NPAWRMA.controller.header", {
    formatter: formatter,
    onInit: function(evt) {
  
    },
    onPress: function(oeve) {
    debugger; 
    var selcbu = oeve.getSource().getBindingContext("odata").getProperty("KTEXT");
    var otable = oeve.getSource().getTable("table");
    var ocolumn = otable.getColumns();
  
    }
   });
  });</code></pre>
  </div>
  </div>
  </p>
  
  <p><strong>header.view.xml</strong></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>&lt;mvc:View controllerName="NPAWRMA.controller.header" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:mvc="sap.ui.core.mvc"
    displayBlock="true" xmlns="sap.m" xmlns:l="sap.ui.layout"&gt;
    &lt;App id="idAppControl"&gt;
      &lt;pages&gt;
        &lt;Page title="NPAW RMA Report"&gt;
          &lt;content&gt;
            &lt;l:VerticalLayout&gt;
              &lt;Table id="table" growing="true" items="{odata&gt;/npirevSet}"&gt;
                &lt;columns&gt;
                  &lt;Column&gt;
                    &lt;Text text="CBU" id="CbuShortNameColumnTitle"/&gt;
                  &lt;/Column&gt;
                  &lt;Column&gt;
                    &lt;Text text="{Labels&gt;/Labels1/Label01}"/&gt;
                  &lt;/Column&gt;
                  &lt;Column&gt;
                    &lt;Text text="{Labels&gt;/Labels1/Label02}"/&gt;
                  &lt;/Column&gt;
                  &lt;Column&gt;
                    &lt;Text text="{Labels&gt;/Labels1/Label03}"/&gt;
                  &lt;/Column&gt;
                  &lt;Column&gt;
                    &lt;Text text="{Labels&gt;/Labels1/Label04}"/&gt;
                  &lt;/Column&gt;
                  &lt;Column&gt;
                    &lt;Text text="{Labels&gt;/Labels1/Label05}"/&gt;
                  &lt;/Column&gt;
                  &lt;Column&gt;
                    &lt;Text text="{Labels&gt;/Labels1/Label06}"/&gt;
                  &lt;/Column&gt;
                  &lt;Column&gt;
                    &lt;Text text="{Labels&gt;/Labels1/Label07}"/&gt;
                  &lt;/Column&gt;
                  &lt;Column&gt;
                    &lt;Text text="{Labels&gt;/Labels1/Label08}"/&gt;
                  &lt;/Column&gt;
                &lt;/columns&gt;
                &lt;items&gt;
                  &lt;ColumnListItem type="Active" press="onPress"&gt;
                    &lt;cells&gt;
                      &lt;Text text="{odata&gt;KTEXT}"/&gt;
                      &lt;ObjectNumber number="{ path: 'odata&gt;NpiPerc01', formatter: '.formatter.numberUnit' }"  state="{State01}"/&gt;
                      &lt;ObjectNumber number="{ path: 'odata&gt;NpiPerc02', formatter: '.formatter.numberUnit' }"  state="{State02}"/&gt;
                      &lt;ObjectNumber number="{ path: 'odata&gt;NpiPerc03', formatter: '.formatter.numberUnit' }"  state="{State03}"/&gt;
                      &lt;ObjectNumber number="{ path: 'odata&gt;NpiPerc04', formatter: '.formatter.numberUnit' }"  state="{State04}"/&gt;
                      &lt;ObjectNumber number="{ path: 'odata&gt;NpiPerc05', formatter: '.formatter.numberUnit' }"  state="{State05}"/&gt;
                      &lt;ObjectNumber number="{ path: 'odata&gt;NpiPerc06', formatter: '.formatter.numberUnit' }"  state="{State06}"/&gt;
                      &lt;ObjectNumber number="{ path: 'odata&gt;NpiPerc07', formatter: '.formatter.numberUnit' }"  state="{State07}"/&gt;
                      &lt;ObjectNumber number="{ path: 'odata&gt;NpiPerc08', formatter: '.formatter.numberUnit' }"  state="{State08}"/&gt;
                      &lt;ObjectNumber number="{ path: 'odata&gt;NpiPerc09', formatter: '.formatter.numberUnit' }"  state="{State09}"/&gt;
                    &lt;/cells&gt;
                  &lt;/ColumnListItem&gt;
                &lt;/items&gt;
              &lt;/Table&gt;
              &lt;Table id="table1" class=".table1" growing="true" items="{odata&gt;/npirevSet}"&gt;
                &lt;columns&gt;
                  &lt;Column&gt;
                    &lt;Text text="CBU" id="CbuShortNameColumnTitle1"/&gt;
                  &lt;/Column&gt;
                  &lt;Column&gt;
                    &lt;Text text="{Labels&gt;/Labels1/Label01}"/&gt;
                  &lt;/Column&gt;
                  &lt;Column&gt;
                    &lt;Text text="{Labels&gt;/Labels1/Label02}"/&gt;
                  &lt;/Column&gt;
                  &lt;Column&gt;
                    &lt;Text text="{Labels&gt;/Labels1/Label03}"/&gt;
                  &lt;/Column&gt;
                  &lt;Column&gt;
                    &lt;Text text="{Labels&gt;/Labels1/Label04}"/&gt;
                  &lt;/Column&gt;
                  &lt;Column&gt;
                    &lt;Text text="{Labels&gt;/Labels1/Label05}"/&gt;
                  &lt;/Column&gt;
                  &lt;Column&gt;
                    &lt;Text text="{Labels&gt;/Labels1/Label06}"/&gt;
                  &lt;/Column&gt;
                  &lt;Column&gt;
                    &lt;Text text="{Labels&gt;/Labels1/Label07}"/&gt;
                  &lt;/Column&gt;
                  &lt;Column&gt;
                    &lt;Text text="{Labels&gt;/Labels1/Label08}"/&gt;
                  &lt;/Column&gt;
                &lt;/columns&gt;
                &lt;items&gt;
                  &lt;ColumnListItem type="Active"&gt;
                    &lt;cells&gt;
                      &lt;Text text="{odata&gt;KTEXT}"/&gt;
                      &lt;ObjectNumber number="{ path: 'odata&gt;NpiPerc01', formatter: '.formatter.numberUnit' }" unit="%" state="{State01}"/&gt;
                      &lt;ObjectNumber number="{ path: 'odata&gt;NpiPerc02', formatter: '.formatter.numberUnit' }" unit="%" state="{State02}"/&gt;
                      &lt;ObjectNumber number="{ path: 'odata&gt;NpiPerc03', formatter: '.formatter.numberUnit' }" unit="%" state="{State03}"/&gt;
                      &lt;ObjectNumber number="{ path: 'odata&gt;NpiPerc04', formatter: '.formatter.numberUnit' }" unit="%" state="{State04}"/&gt;
                      &lt;ObjectNumber number="{ path: 'odata&gt;NpiPerc05', formatter: '.formatter.numberUnit' }" unit="%" state="{State05}"/&gt;
                      &lt;ObjectNumber number="{ path: 'odata&gt;NpiPerc06', formatter: '.formatter.numberUnit' }" unit="%" state="{State06}"/&gt;
                      &lt;ObjectNumber number="{ path: 'odata&gt;NpiPerc07', formatter: '.formatter.numberUnit' }" unit="%" state="{State07}"/&gt;
                      &lt;ObjectNumber number="{ path: 'odata&gt;NpiPerc08', formatter: '.formatter.numberUnit' }" unit="%" state="{State08}"/&gt;
                      &lt;ObjectNumber number="{ path: 'odata&gt;NpiPerc09', formatter: '.formatter.numberUnit' }" unit="%" state="{State09}"/&gt;
                    &lt;/cells&gt;
                  &lt;/ColumnListItem&gt;
                &lt;/items&gt;
              &lt;/Table&gt;
            &lt;/l:VerticalLayout&gt;
          &lt;/content&gt;
        &lt;/Page&gt;
      &lt;/pages&gt;
    &lt;/App&gt;
  &lt;/mvc:View&gt;</code></pre>
  </div>
  </div>
  </p>