Report post

Are you sure you want to report the post shown below? This will send an email to the ATVO administrators. Please include a short reason for reporting.

Users reporting for no reason may be locked out.


Post

Posted by Nick Thissen
on
Emmanuel Suter wrote:
Other things.
Is it possible to change Data Class filter of a widget ?
For some ticker or resluts, it will be intersting to just change that for show standing class1 or class2 or all.
You can change the DataClassIndex property of the widget just by specifying a new value. The type must be one of the available values in the DataClassIndex enum. The possible values are:
  • DataClassIndex.FollowedClass = -1
  • DataClassIndex.AllClasses= 0
  • DataClassIndex.Class1 = 1
  • DataClassIndex.Class2 = 2
  • etc...
  • DataClassIndex.Class10 = 10

using System;
using ATVO.ThemesSDK;
using ATVO.ThemeEditor.ThemeModels;
using ATVO.ThemeEditor.Scripting.DotNET;
using ATVO.ThemeEditor.Data;

namespace Scripts
{
public class ChangeClassIndex : IScript
{
public object Execute(ThemeContentItem item, object value, string parameter, ISimulation sim)
{
var widget = item.Theme.Widgets.Find("Widget1");

// Change to FollowedClass
widget.DataClassIndex = DataClassIndex.FollowedClass;

// Change to class 2
widget.DataClassIndex = DataClassIndex.Class2;

// Change to class "n" where n is an integer 1-10
var n = 5;
widget.DataClassIndex = (DataClassIndex)n;

return null;
}
}
}



I may add new options to change a class filter via actions in the ChangeDataSource actions, instead of requiring a script.