Skip to main content

Is there formula syntax for viewport width?


Use case:


I load certain models after render using the Skuid Page: Rendered Event.


I would like to add a branch with an IF statement to load or not load specific models based on the viewport width so I can load specific models for mobile vs. desktop.

Sorry Duane - there is not Formula Syntax for returning the current viewport width. There have been a number of snippet based approaches published here through the years that collect viewport on page load and update a UI Only field - which you then can use for the sort of branching you describe.


See this one:



Skuid, please implement this as declarative.
(function(skuid){
var $ = skuid.$;
$(document.body).one('pageload',function(){
var ADashUIOnly = skuid.$M('ADashUIOnly'),
row = ADashUIOnly.getFirstRow();
window.addEventListener("resize", setWidth); function setWidth(){
ADashUIOnly.updateRow(row,'minWidth',$(window).width());
}
});
})(skuid);

See: “YouTube


Reply