
Announcements
In a model driven app i am attempting to set a view of a subgrid using Javascript on onload form. When the page load I see the view fllcking back and forth between the default view and the view I am trying to set, sometimes settling on one or the other.
This is my JS file:
function fnChangeViewOfSubgrid(executionContext) {
"use strict";
var oFormContext = executionContext.getFormContext();
var parameter = oFormContext.data.entity.attributes.get('cr84b_parameter').getValue();
var viewSelector = oFormContext.getControl("Subgrid_new_3").getViewSelector();
switch(parameter){
case 100000000:
var DynamiskView = {
entityType: 1039, // SavedQuery
id: "8397137f-a65e-ed11-9561-6045bd90516a",
name: "Suspenderede stoffer"
};
break;
case 206200000:
var DynamiskView = {
entityType: 1039,
id: "f44c6642-a65e-ed11-9561-6045bd90516a", //id på view
name: "pH"
};
default:
var DynamiskView = {
entityType: 1039,
id: "07f4d2c7-a65e-ed11-9561-6045bd90516a",
name: "Ammonium-N"
};
}
viewSelector.setCurrentView(DynamiskView);
}
Any idea of what I am doing wrong or missing?