Hi Experts,
I am using sap.ui.table in my application. The enableSelectionMode is set to None, since the extra column on the left hand side is not desired. Now when the user clicks on a particular row, I need to determine the row number. I m unable to do this. I was trying to use oEvent.getSource()._iLastSelectedDataRow, but this does not give me the exact row. Is there any other method that I can use determine the exact row? My code goes as follows.
<table:Table id="savedBatchesTable" width="auto" visibleRowCount="8" allowColumnReordering="false" editable="false" navigationMode="Scrollbar" threshold="100" enableSelectAll="false" selectionMode="None" enableColumnReordering="false" columnHeaderVisible="true" noDataText="No Saved Batches" cellClick="retrieveItemsFromSavedBatches"> <table:columns> <table:Column width="5%" hAlign="Center"> <Label text=""></Label> <table:template> <Text text="{sNo}" /> </table:template> </table:Column> <table:Column width="50%" sortProperty="batchSubmittedDate" hAlign="Center"> <Label text="BATCH SUBMISSION TIME"></Label> <table:template> <Text text="{batchSubmittedDate}" /> </table:template> </table:Column> <table:Column width="35%" hAlign="Center"> <Label id="totalItems" text="TOTAL ITEMS IN BATCH"></Label> <table:template> <Text text="{totalItems}" /> </table:template> </table:Column> <table:Column width="5%" hAlign="Center"> <table:template> <Icon xmlns="sap.ui.core" src="sap-icon://delete" size="" color="" hoverColor="" activeColor="" width="" height="" backgroundColor="" hoverBackgroundColor="" activeBackgroundColor="" decorative="true" press="" class="hoverVisible"> </Icon> </table:template> </table:Column> </table:columns> </table:Table>
var oSorter = new sap.ui.model.Sorter("batchSubmittedDate", true); // sort descending Saved_Batches_oModel = new sap.ui.model.json.JSONModel(); Saved_Batches_oModel.setData(savedBatchesData); var savedTable = that.byId("savedBatchesTable"); savedTable.setModel(Saved_Batches_oModel); savedTable.bindRows("/"); savedTable.getBinding("rows").sort(oSorter);
Thanks
Maruthi