TimeSpanView inside a GroupView is not processing properly
homeseerwu opened this issue · 2 comments
TimeSpanView not processing properly in EventTrigger UI
Environment
HomeSeer
OS
Windows
HS Version
v4.2.16.0
Development
PSDK Version
v1.4.2.0
Language
C#
IDE
VS2019
Dev OS
Womdpws
Page
Event Trigger (custom plugin event trigger)
Problem
Description
My event trigger UX has added a TimeSpanView inside a GroupView. When I change the TimeSpanView's values via Edge browser I don't receive a callback into my event trigger plugin (no call is made to OnConfigItemUpdate()).
Walking through the browser javascript code for this page (/events.html?ref=13&subpage=event.html) I see that the viewValueChanged() function is going a div parent level too high (it assumes that the view is not in a group):
function viewValueChanged(event) {
// .... skip a bunch of code....
else if (view.classList.contains('jui-timespan')) {
var parentdiv = **$('div.jui-view:has(#' + viewIdEscaped + ')')[0];**
var id = parentdiv.getAttribute("id");
var days = $('#' + id + '-days').val();
The above bold code assigns parentdiv
GroupView div element, not the actual TimeSpanView div element.
If I change the it to:
var parentlist = $('div.jui-view:has(#' + viewIdEscaped + ')');
var parentdiv = parentlist[parentlist.length - 1];
It works as expected.
Screenshots
Expected Behavior
Expected to receive a callback to OnConfigItemUpdate in my event trigger class.
Steps to Reproduce
Provide steps so the HomeSeer team can reproduce the reported problem and see the same thing:
- Create a TriggerClass with a GroupView.
- Add a TimeSpanView inside the GroupView
- Create a new event, select your trigger class
- Modify the time span settings (eg, change 0 min to 5 min)
- Note that your OnConfigItemUpdate() is not called.
Logs
Tracked as HS-1747
This is fixed in HS4 version 4.2.16.7.
Thanks for the report and the solution