Cannot Find Name 'jquery' Error In Controller.js
I am developing a UI5 app in VS Code. I added a new count function to the *.controller.js file, and in order to display the count from the server, I am using jQuery like in the fol
Solution 1:
I assume this._mFilters
is an object. In that case, try with:
Object.keys(this._mFilters).map(sFilterKey => {
const oFilter = this._mFilters[sFilterKey];
oModel.read("/portfolios/$count", {
filters: [ oFilter ],
success: function(sCount) {
const sPath = `/${sFilterKey}`;
oViewModel.setProperty(sPath, +sCount);
},
});
});
Also the parameter filters
awaits an array instead of a single Filter instance.
If jQuery is still preferred, include "sap/ui/thirdparty/jquery"
(formerly "jquery.sap.global"
) to the dependency list of the controller.
sap.ui.define([
"sap/ui/core/mvc/Controller",
// ...,"sap/ui/thirdparty/jquery",
], function(Controller,/*...,*/ jQuery) {
// jQuery is here available
});
Post a Comment for "Cannot Find Name 'jquery' Error In Controller.js"