How to find the OData model version from the sap.ui.table.Table instance

Steps to be followed:

  1. Get the instance of table sap.ui.table.Table
  2. Get the Binding instance using the getBinding method of table instance
  3. Get the path of the OData Model using the getPath method of the ODataListBinding
  4. Get the model instance using the getModel() method of the ODataListBinding
  5. The OData version is defined in the metadata. so using the getMetadata() method of the model instance, the OData version can be determined
var bindingInstance = uiTableInstance.getBinding('rows')
var sPathOfModel = uiTableInstance.getBinding('rows').getPath()
var modelInstance = uiTableInstance.getBindng('rows').getModel(sPathOfModel)
modelInstance.getMetadata() ===> This will get the sap.ui.model.odata.v2.ODataModel version.

How to get the Binding path of sap.m.Table

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)
var modelBinding = mTableInstance.getBinding('items');
var pathOfModel = modelBinding.getPath();

The pathOfModel contains a string value.