Skip to content

Local Overrides Sample: Include Individual Cameras in Group Dropdowns

bp2008 edited this page Aug 24, 2019 · 4 revisions

If this script is pasted into your ui3-local-overrides.js file, it will add all your individual cameras to the "Current Group" and "Filter Clips by" dropdown lists.

To learn more about ui3-local-overrides.js, see: Local Overrides Scripts and Styles

$(function ()
{
	/// <summary>
	/// This local-overrides script for UI3 changes the "Current Group" / "Filter Clips by" dropdown lists so they contain individual cameras, too.
	/// </summary>
	dropdownBoxes.listDefs["currentGroup"] = new DropdownListDefinition("currentGroup",
		{
			onItemClick: function (item)
			{
				var camData = cameraListLoader.GetCameraWithId(item.id);
				if (camData)
					videoPlayer.LoadLiveCamera(camData);
				else
					videoPlayer.LoadHomeGroup();
			}
			, rebuildItems: function (data)
			{
				this.items = [];
				for (var i = 0; i < data.length; i++)
				{
					this.items.push(new DropdownListItem(
						{
							text: CleanUpGroupName(data[i].optionDisplay)
							, id: data[i].optionValue
						}));
				}
			}
		});
});
Clone this wiki locally