Fripou Posted March 18, 2015 Share Posted March 18, 2015 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 More sharing options...
justsomeguy Posted March 18, 2015 Share Posted March 18, 2015 You're saying that oTableSuser.getSelectedIndex() returns -1? Is there documentation online for that library? Link to comment Share on other sites More sharing options...
Fripou Posted March 19, 2015 Author Share Posted March 19, 2015 You're saying that oTableSuser.getSelectedIndex() returns -1? Is there documentation online for that library? Yes oTableSuser.getSelectedIndex() returns -1 The link to the documentation : https://openui5.hana.ondemand.com/#docs/api/symbols/sap.ui.table.Table.html Link to comment Share on other sites More sharing options...
justsomeguy Posted March 19, 2015 Share Posted March 19, 2015 It looks like that means that there is no selection. When do you call that function? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now