cancel
Showing results for 
Search instead for 
Did you mean: 

UI5 - Not able to get model from UI table

Former Member
0 Kudos

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 ?

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member182862
Active Contributor
0 Kudos

HI

oTable1.getModel(); should be

oTable1.getModel('ajaxtown');

Thanks

-D