Jump to content

SAPUI5 : How to get the index of a row?


Fripou

Recommended Posts

Hello,
To start, sorry for my english i'm French ^^
I have a problem, in fact I can't retrieve the index of the row in a table. I tried many things but I haven't found the solution. Here is my code:
<script id='TableSuser'>    var oTableSuser = new sap.ui.table.Table({editable:false, width: "400px", visibleRowCount:2});    var oControl = new sap.ui.commons.Button({text : "{suser}",  press : function() {openDialog(oTableSuser.getSelectedIndex());}});    oTableSuser.addColumn(new sap.ui.table.Column({label: new sap.ui.commons.Label({text: "Suser"}), template: oControl, sortProperty: "Button", filterProperty: "Button", name: "password_colonne"}));    oControl = new sap.ui.commons.TextView({text:"{suser_mdp}"});    oTableSuser.addColumn(new sap.ui.table.Column({label: new sap.ui.commons.Label({text: "suser_mdp"}), template: oControl, sortProperty: "suser_mdp", filterProperty: "suser_mdp", visible: false}));         var oModel = new sap.ui.model.json.JSONModel();    oModel.loadData("suser.php");    oTableSuser.setModel(oModel);    oTableSuser.bindRows("/");         function openDialog(index) {    var currentRowContext = oTableSuser.getContextByIndex(index);    var valeur_suser_mdp = oModel.getProperty("suser_mdp",currentRowContext);          alert(index);    alert(currentRowContext);    alert(valeur_suser_mdp);    oTableSuser.getColumns()[1].setVisible(true);    };    oTableSuser.placeAt("suser");    </script>
I would like to retrieve the index of the row when I call the function function() {openDialog(oTableSuser.getSelectedIndex());}
I tried different things and I didn't find how to retrieve the index of the row, I always have "-1"
If someone has an idea I'm interested? :)
Thx
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...