Yura, the only explanation I have - somwhere in the code selectedFieldsCounter model is overwritten
btw, is line 1 always before line 2? to async conflict or anything?
try
var oSelectedFieldsModel = new sap.ui.model.json.JSONModel( {
counter : 0
} );
sap.ui.getCore().setModel(oSelectedFieldsModel, "selectedFieldsCounter");
console.log("oninit(). ",oSelectedFields); //(1)
var oSelectedFields = sap.ui.getCore().getModel("selectedFieldsCounter").getData();
console.log(oSelectedFields);//(2)
in the same place