Skip to Content
avatar image
Former Member

UI5 - Not able to get model from UI table

I created a oData service. Currently it can do only read operations. My app workflow is something like this:

  • Create a new instance of oData Model by passing the service url.
  • Store the model inside core by the key 'ajaxtown'.
  • Create a new table and bind the ajaxtown model to display the rows. (works)
  • Select one row and get the data. (not working)

The demo is inside JSBIN - http://jsbin.com/laqufupoba/1/watch?html,output

EDIT: The demo uses the service from localhost (so you wont be able to see the output, but it works)

Below is the part of code which doesnt work:

var idx = oTable1.getSelectedIndex();
  if (idx !== -1) {
  var m = oTable1.getModel(); // says undefined
  var data = m.getData(); // doesnt work
  var removed = data.splice(idx, 1);
  m.setData(data)

Any clues what might be wrong ?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Dec 27, 2014 at 08:06 PM

    HI

    oTable1.getModel(); should be

    oTable1.getModel('ajaxtown');

    Thanks

    -D

    Add comment
    10|10000 characters needed characters exceeded