How to get the sap.ui.model.Model instance from sap.m.Table instance

It requires the following steps:

  1. Get the Table instance of sap.m.Table
  2. call the getBinding() method to get the instance of sap.ui.model.Binding
  3. From the instance of sap.ui.model.Binding, call the getPath() method. It returns the path of the Model to which the Binding happens. ( Code Example below)
  4. pass the model path value in the method getModel() of sap.ui.model.Binding. It returns the sap.ui.model.Model instance.
var modelBindingInstance = mTableInstance.getBinding('items');
var modelPath = modelBindingInstance.getPath()
var modelInstance = modelBindingInstance.getModel(modelPath);