Tuesday 15 March 2011

javascript - SAPUI5 : How to get the index of a row? -


Text after "

I have a problem, in fact I can not get index of row in a table. I tried a lot of things but I did not get the solution. Here's my code:

  & lt; Script id = 'TableSuser' & gt; Var oTableSuser = new sap.ui.table.Table ({editable: wrong, width: "400px", visible line number: 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: "buttons", 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", Views: 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); warning (index); warning (currentRowContext); warning (valeur_suser_mdp); oTableSuser.getColumns () [1] .setVisible (right);}; oTableSuser.placeAt ( "suser"); & Lt; / script & gt;  

when I function function () {openDialog ( oT Call to enableSuser.getSelectedIndex () ), then I want to retrieve the line pointer;}

I tried various things and gave me the line indicator How to get it, I always have "-1" if anyone has any ideas that I am interested in? :)

"itemprop =" text ">

After you have a template function in the timeline (for which a variable does not work) passing rendering, nothing is decided so -1)

the better your code like this:

  var oControl = new sap.ui.commons.Button ( {Text: "{Suser}", press: oController.openDialog});  

And in your controller, your defined openDialog method is as follows:

  openDialog: function (oEvent) {var tbl = Sap.ui.getCore (). ById ("id_of_your_table"), index = tbl.getSelectedIndex (); }  

No comments:

Post a Comment