Scandit.Ui.Views

Provides methods for working with builtin activity views. Currently it's based on the Ractive engine.

View provides following helper functions:

See:

Examples

load view and change context dynamically (no need to reload the view)
  • JavaScript
  • ES6
  • view/view.html
var view = Scandit.Ui.Views.load('views/view.html', {testvariable: 'Hello world'});
view.set({testvariable: 'Hello world 2'});
view.set('testvariable','Hello world 2');
const view = Scandit.Ui.Views.load('views/view.html', {testvariable: 'Hello world'});
view.set({testvariable: 'Hello world 2'});
view.set('testvariable','Hello world 2');
<h1>{{ testvariable }}</h1>

Methods

(static) load(viewPath: string, context?: object, options?: object): Ractive

Loads view into main view area. Replaces all existing elements.

Parameters:
Name Type Attributes Default Description
viewPath string

Path to the view, relative to index.html (project root), e.g "views/view.html"

context object <optional>
{}

Context variables for view rendering

options object <optional>
{}
Properties
Name Type Attributes Default Description
scrollTop boolean <optional>
true

Scrolls interface to the top after loading new view

Returns:
Examples
  • JavaScript
  • ES6
var view = Scandit.Ui.Views.load('views/view.html', {variable: 'value'});
const view = Scandit.Ui.Views.load('views/view.html', {variable: 'value'});