title: Reading user-input from Table in sapui5
body: <p>I am writing a front-end program in <code>SAPUI5</code>, which should allow the user to input data (like char or numbers) into a table, and then, furthermore, read data, after clicking on a button "submit"</p>
  
  <p>What I saw so far was everything related to get data from a selected row.</p>
  
  <p>I am really new to this field so I appreciate any help!</p>
  
  <p>I am using <code>sap.ui.commons.table.Table</code>. The table initially gets it's data from a <code>JSON</code> file but that I have done in order to test the binding. </p>
  
  <pre><code>//data definition: 
  var oPosData = [{PoItemI : "0010"}];
  
  //Table: 
  var oTable = new sap.ui.table.Table("PoData",{
      //title: "Positionsdetails",
      visiblRowCount: 5,
      firstVisibleRow: 3,
      selectionMode: sap.ui.table.SelectionMode.Single
  });
  
  // For simplicity, i will just ad 1 column to the table. but i have more
  //Positionsnummer:
      var oColumn_PosNr = new sap.ui.table.Column("PosNr",{
      label: new sap.ui.commons.Label({text: "Position"}),
      //template: new sap.ui.commons.TextView().bindProperty("text", "Positionsnummer"),
      template: Input1 = new sap.ui.commons.TextField("PosNrTF",{
          key: "text", 
          value: "{PoItemI}"
      }),
      //sortProperty: "Positionsnummer",
      //filterProperty: "Positionsnummer",
      width: "200px"
  });
  
  //Input1.setValue("Bla");  Input1.getValue());
  //Input1.attachChange(function(oEvent) {
      var output = oEvent.getSource().getBindingContext().getPath();
      alert('Text changed to : '+ output);
      console.log(output)
  });
  oTable.addColumn(oColumn_PosNr);
  
  //Create a model and bind the table rows to this model
  var oModel_Item = new sap.ui.model.json.JSONModel();
  oModel_Item.setData({modelData: oPosData});
  oTable.setModel(oModel_Item);
  oTable.bindRows("/modelData");
  </code></pre>
  
  <p>Is it wrong to do it with this table control? Or am I doing the binding wrong? When I try to read it doesn't work. </p>
  
  <p>I am as well getting trouble to extract the binding part of the controls.</p>
  
  <pre><code>// Submit button
  // I would be happy if this button prints me the value, that is stored in the
  //table 
  
  var oButton1 = new sap.ui.commons.Button({
  text : "Submit",
  style: sap.ui.commons.ButtonStyle.Emph,
  width: '50%',
  //tooltip : "",
  //press : function() {alert('Pressed me' + );}
  press : function() {
  
  var table_model = sap.ui.getCore().getControl("PoData").getModel();//.getPath();//.getPath();
  var table_row = sap.ui.getCore().getControl("PoData").getRows()[1].getCells()[1];//.getValue();
  var table_path = sap.ui.getCore().getControl("PosNrTF").getBindingContext(table_model);//.getPath();
  var table_column_LABEL = oTable.getColumns()[0].getLabel().mProperties.text;
  var table_column_template = oTable.getColumns()[0][1];//getBindingContext();
  
  alert(table_column_LABEL);
  alert(table_model);
  alert(table_row);
  alert(table_path);
  alert(table_column_template);
  
  },
  layoutData : new sap.ui.layout.GridData({
      indent: "L5 M5",
      span: "L1 M6 S12"
  })
  
  });
  </code></pre>
  
  <p>I can't get the value which is stored within the template part of the column, if it is stored there. </p>
  
  <p>Shall I do it in a different way like adding rows to the table instead of column?  I came across <em>CustomData</em> or <em>Content</em> but don't know how to use it and if this solves the problem?! Should i use binding at all if i am just interested in the data that the user inputs or binding will help me by "automatically updating the value" through Two-Way binding (no clue how to do that).</p>