This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Custom JavaScript examples
Hello,
I would like to complete the following JavaScript by performing two different functions. One that works like on the java below and the other that sets the opacity to 0 and always leaving pointer-events to none. On different addresses. For example for disabledbyknx0 to 10 we will have so false then opacity to 0 and pointer-events to none and so true then opacity to 1 and pointer-events none. On the other hand for disablebyknx10 to 20 a so false then opacity to 0.5 and pointer-events to none so true then opacity to 1 and pointer-events to all.
Best regards

Java script (Thanks Erwin) :
$(function(){

// Table with parameters
var ClassTable = [
{ address:"0/6/1", cssclass:"disabledbyknx1" },
{ address:"0/6/2", cssclass:"disabledbyknx2" },
{ address:"0/6/3", cssclass:"disabledbyknx3" },
{ address:"0/6/4", cssclass:"disabledbyknx4" },
{ address:"0/6/5", cssclass:"disabledbyknx5" },
{ address:"0/6/6", cssclass:"disabledbyknx6" },
{ address:"0/6/7", cssclass:"disabledbyknx7" },
{ address:"0/6/8", cssclass:"disabledbyknx8" },
{ address:"0/6/9", cssclass:"disabledbyknx9" },
{ address:"0/6/10", cssclass:"disabledbyknx10" },
{ address:"0/6/11", cssclass:"disabledbyknx11" },
{ address:"0/6/12", cssclass:"disabledbyknx12" },
{ address:"0/6/13", cssclass:"disabledbyknx13" },
{ address:"0/6/14", cssclass:"disabledbyknx14" },
{ address:"0/6/15", cssclass:"disabledbyknx15" },
{ address:"0/6/16", cssclass:"disabledbyknx16" },
{ address:"0/6/17", cssclass:"disabledbyknx17" },
{ address:"0/6/18", cssclass:"disabledbyknx18" },
{ address:"0/6/19", cssclass:"disabledbyknx19" },
{ address:"0/6/20", cssclass:"disabledbyknx20" },
{ address:"0/6/21", cssclass:"disabledbyknx21" },
{ address:"0/6/22", cssclass:"disabledbyknx22" },
{ address:"0/6/23", cssclass:"disabledbyknx23" },
{ address:"0/6/24", cssclass:"disabledbyknx24" },
];

// Function to create event listeners
function CreateListeners(groupaddr,classname){
var ObjectAddress = Scada.encodeGroupAddress(groupaddr); // Use 1 bit object !
objectStore.addListener(ObjectAddress, function(obj, type) {
if ( obj.value == false ) {
$("." + classname).css("opacity", 0.5);
$("." + classname).css("pointer-events", 'none');
} else {
$("." + classname).css("opacity", 1);
$("." + classname).css("pointer-events", 'all');
}
});
}

for (var i in ClassTable) {
CreateListeners(ClassTable[i].address,ClassTable[i].cssclass)
}

});

BR
Gadjoken

I try this and it works :

$(function(){

// Table with parameters
var ClassTable = [
{ address:"32/1/1", cssclass:"disabledbyknx" },
{ address:"32/1/1", cssclass:"disabledbyknx1" },
];
// Function to create event listeners
function CreateListeners(groupaddr,classname){
var ObjectAddress = Scada.encodeGroupAddress(groupaddr); // Use 1 bit object !
objectStore.addListener(ObjectAddress, function(obj, type) {
if ( obj.value == false ) {
$("." + classname).css("opacity", 0.5);
$("." + classname).css("pointer-events", 'none');
} else {
$("." + classname).css("opacity", 1);
$("." + classname).css("pointer-events", 'all');
}

});
}

for (var i in ClassTable) {
CreateListeners(ClassTable[i].address,ClassTable[i].cssclass)
}

// Table with parameters
var ClassTable2 = [
{ address:"32/1/5", cssclass2:"disabledbyknx2" },
];

// Function to create event listeners
function CreateListeners2(groupaddr,classname2){
var ObjectAddress = Scada.encodeGroupAddress(groupaddr); // Use 1 bit object !
objectStore.addListener(ObjectAddress, function(obj, type) {
if ( obj.value == false ) {
$("." + classname2).css("opacity", 0);
$("." + classname2).css("pointer-events", 'none');
} else {
$("." + classname2).css("opacity", 1);
$("." + classname2).css("pointer-events", 'none');
}

});
}

for (var i in ClassTable2) {
CreateListeners2(ClassTable2[i].address,ClassTable2[i].cssclass2)
}

});

BR
Gadjoken.
Reply


Messages In This Thread
Custom JavaScript examples - by edgars - 13.04.2016, 11:27
RE: Custom JavaScript examples - by edgars - 15.04.2016, 10:06
RE: Custom JavaScript examples - by buuuudzik - 16.04.2016, 18:53
RE: Custom JavaScript examples - by Joep - 21.03.2024, 09:26
RE: Custom JavaScript examples - by buuuudzik - 21.04.2016, 17:39
RE: Custom JavaScript examples - by buuuudzik - 25.04.2016, 08:53
RE: Custom JavaScript examples - by buuuudzik - 25.04.2016, 13:11
RE: Custom JavaScript examples - by Pawel - 26.04.2016, 19:23
RE: Custom JavaScript examples - by Pawel - 27.04.2016, 07:03
RE: Custom JavaScript examples - by Pawel - 27.04.2016, 08:05
RE: Custom JavaScript examples - by edgars - 28.04.2016, 08:30
RE: Custom JavaScript examples - by buuuudzik - 07.06.2016, 13:15
RE: Custom JavaScript examples - by buuuudzik - 08.06.2016, 06:47
RE: Custom JavaScript examples - by buuuudzik - 10.06.2016, 12:55
RE: Custom JavaScript examples - by buuuudzik - 13.06.2016, 06:27
RE: Custom JavaScript examples - by buuuudzik - 01.09.2016, 08:20
RE: Custom JavaScript examples - by Pawel - 13.06.2016, 06:59
RE: Custom JavaScript examples - by buuuudzik - 07.10.2016, 13:58
RE: Custom JavaScript examples - by admin - 13.06.2016, 09:02
RE: Custom JavaScript examples - by buuuudzik - 13.06.2016, 09:36
RE: Custom JavaScript examples - by buuuudzik - 13.06.2016, 12:21
RE: Custom JavaScript examples - by buuuudzik - 13.06.2016, 13:43
RE: Custom JavaScript examples - by buuuudzik - 13.06.2016, 16:52
RE: Custom JavaScript examples - by buuuudzik - 13.06.2016, 20:32
RE: Custom JavaScript examples - by gtsamis - 14.06.2016, 07:04
RE: Custom JavaScript examples - by admin - 14.06.2016, 07:31
RE: Custom JavaScript examples - by admin - 01.07.2016, 07:46
RE: Custom JavaScript examples - by admin - 01.07.2016, 10:18
RE: Custom JavaScript examples - by buuuudzik - 06.10.2016, 10:04
RE: Custom JavaScript examples - by admin - 07.10.2016, 17:38
RE: Custom JavaScript examples - by buuuudzik - 07.10.2016, 19:41
RE: Custom JavaScript examples - by buuuudzik - 10.10.2016, 13:17
RE: Custom JavaScript examples - by buuuudzik - 08.10.2016, 16:35
RE: Custom JavaScript examples - by buuuudzik - 08.10.2016, 19:01
RE: Custom JavaScript examples - by buuuudzik - 09.10.2016, 06:36
RE: Custom JavaScript examples - by buuuudzik - 09.10.2016, 15:32
RE: Custom JavaScript examples - by buuuudzik - 09.10.2016, 17:44
RE: Custom JavaScript examples - by admin - 10.10.2016, 09:24
RE: Custom JavaScript examples - by admin - 10.10.2016, 09:32
RE: Custom JavaScript examples - by admin - 10.10.2016, 13:34
RE: Custom JavaScript examples - by buuuudzik - 10.10.2016, 13:41
RE: Custom JavaScript examples - by buuuudzik - 11.10.2016, 09:59
RE: Custom JavaScript examples - by admin - 11.10.2016, 10:21
RE: Custom JavaScript examples - by admin - 11.10.2016, 10:46
RE: Custom JavaScript examples - by buuuudzik - 11.10.2016, 12:44
RE: Custom JavaScript examples - by admin - 11.10.2016, 12:51
RE: Custom JavaScript examples - by buuuudzik - 11.10.2016, 12:53
RE: Custom JavaScript examples - by admin - 11.10.2016, 12:54
RE: Custom JavaScript examples - by buuuudzik - 11.10.2016, 12:57
RE: Custom JavaScript examples - by admin - 11.10.2016, 13:04
RE: Custom JavaScript examples - by buuuudzik - 11.10.2016, 13:10
RE: Custom JavaScript examples - by buuuudzik - 13.10.2016, 12:57
RE: Custom JavaScript examples - by buuuudzik - 31.10.2016, 11:12
RE: Custom JavaScript examples - by cekca - 02.11.2016, 08:17
RE: Custom JavaScript examples - by admin - 02.11.2016, 11:23
RE: Custom JavaScript examples - by cekca - 02.11.2016, 14:28
RE: Custom JavaScript examples - by admin - 08.11.2016, 13:05
RE: Custom JavaScript examples - by buuuudzik - 05.12.2016, 19:11
RE: Custom JavaScript examples - by admin - 07.12.2016, 11:04
RE: Custom JavaScript examples - by Roman - 16.12.2016, 13:49
RE: Custom JavaScript examples - by admin - 16.12.2016, 14:58
RE: Custom JavaScript examples - by Roman - 16.12.2016, 15:38
RE: Custom JavaScript examples - by AEK - 22.01.2018, 07:01
RE: Custom JavaScript examples - by AEK - 22.01.2018, 08:48
RE: Custom JavaScript examples - by admin - 16.12.2016, 16:01
RE: Custom JavaScript examples - by FatMax - 24.12.2016, 00:08
RE: Custom JavaScript examples - by buuuudzik - 24.12.2016, 07:57
RE: Custom JavaScript examples - by Roman - 10.01.2017, 16:00
RE: Custom JavaScript examples - by AEK - 12.01.2017, 09:04
RE: Custom JavaScript examples - by buuuudzik - 16.01.2017, 16:30
RE: Custom JavaScript examples - by Pawel - 19.01.2017, 11:30
RE: Custom JavaScript examples - by buuuudzik - 19.01.2017, 16:25
RE: Custom JavaScript examples - by buuuudzik - 19.01.2017, 21:16
RE: Custom JavaScript examples - by buuuudzik - 19.01.2017, 21:58
RE: Custom JavaScript examples - by buuuudzik - 20.01.2017, 17:36
RE: Custom JavaScript examples - by admin - 21.01.2017, 07:35
RE: Custom JavaScript examples - by buuuudzik - 21.01.2017, 07:45
RE: Custom JavaScript examples - by buuuudzik - 25.01.2017, 06:10
RE: Custom JavaScript examples - by admin - 25.01.2017, 07:20
RE: Custom JavaScript examples - by rocfusion - 04.05.2017, 19:08
RE: Custom JavaScript examples - by admin - 18.05.2017, 05:54
RE: Custom JavaScript examples - by buuuudzik - 19.05.2017, 08:40
RE: Custom JavaScript examples - by admin - 19.05.2017, 09:05
RE: Custom JavaScript examples - by Gadjoken - 08.06.2017, 07:59
RE: Custom JavaScript examples - by David - 08.06.2017, 13:27
RE: Custom JavaScript examples - by admin - 08.06.2017, 17:21
RE: Custom JavaScript examples - by josep - 08.06.2017, 17:48
RE: Custom JavaScript examples - by baggins - 10.12.2017, 10:04
RE: Custom JavaScript examples - by Daniel - 11.12.2017, 10:28
RE: Custom JavaScript examples - by baggins - 11.12.2017, 11:06
RE: Custom JavaScript examples - by Daniel - 11.12.2017, 11:15
RE: Custom JavaScript examples - by baggins - 11.12.2017, 11:48
RE: Custom JavaScript examples - by admin - 11.12.2017, 11:52
RE: Custom JavaScript examples - by baggins - 11.12.2017, 12:25
RE: Custom JavaScript examples - by admin - 22.01.2018, 11:53
RE: Custom JavaScript examples - by gdimaria - 02.03.2018, 09:39
RE: Custom JavaScript examples - by gdimaria - 02.03.2018, 18:51
RE: Custom JavaScript examples - by gdimaria - 02.03.2018, 20:23
RE: Custom JavaScript examples - by mischa - 15.12.2020, 23:28
RE: Custom JavaScript examples - by buuuudzik - 04.03.2018, 21:14
RE: Custom JavaScript examples - by buuuudzik - 05.03.2018, 08:13
RE: Custom JavaScript examples - by buuuudzik - 06.03.2018, 07:17
RE: Custom JavaScript examples - by Mrinj - 24.03.2018, 20:29
RE: Custom JavaScript examples - by admin - 25.03.2018, 05:46
RE: Custom JavaScript examples - by Mrinj - 25.03.2018, 09:29
RE: Custom JavaScript examples - by Mrinj - 25.03.2018, 09:55
RE: Custom JavaScript examples - by DGrandes - 29.04.2019, 16:32
RE: Custom JavaScript examples - by admin - 29.04.2019, 17:00
RE: Custom JavaScript examples - by DGrandes - 30.04.2019, 10:28
RE: Custom JavaScript examples - by admin - 30.04.2019, 11:59
RE: Custom JavaScript examples - by DGrandes - 30.04.2019, 13:40
RE: Custom JavaScript examples - by admin - 30.04.2019, 14:04
RE: Custom JavaScript examples - by DGrandes - 30.04.2019, 15:38
RE: Custom JavaScript examples - by jlfneira - 08.08.2019, 08:45
RE: Custom JavaScript examples - by tecnorte - 01.04.2020, 11:09
RE: Custom JavaScript examples - by khalil - 05.07.2021, 08:08
RE: Custom JavaScript examples - by Daniel - 03.03.2020, 10:22
RE: Custom JavaScript examples - by Daniel - 03.03.2020, 10:56
RE: Custom JavaScript examples - by Hosutech - 06.03.2020, 07:47
RE: Custom JavaScript examples - by admin - 06.03.2020, 08:06
RE: Custom JavaScript examples - by gtsamis - 06.10.2020, 08:57
RE: Custom JavaScript examples - by admin - 06.10.2020, 09:18
RE: Custom JavaScript examples - by gtsamis - 06.10.2020, 09:41
RE: Custom JavaScript examples - by admin - 16.12.2020, 08:02
RE: Custom JavaScript examples - by mischa - 16.12.2020, 08:18
RE: Custom JavaScript examples - by admin - 16.12.2020, 08:25
RE: Custom JavaScript examples - by serkank - 26.04.2021, 09:37
RE: Custom JavaScript examples - by admin - 26.04.2021, 09:51
RE: Custom JavaScript examples - by serkank - 26.04.2021, 11:16
RE: Custom JavaScript examples - by tigi - 29.06.2021, 16:26
RE: Custom JavaScript examples - by admin - 29.06.2021, 16:46
RE: Custom JavaScript examples - by tigi - 07.07.2021, 09:09
RE: Custom JavaScript examples - by admin - 18.08.2023, 12:24
RE: Custom JavaScript examples - by admin - 18.08.2023, 13:02
RE: Custom JavaScript examples - by sgraystar - 07.04.2024, 21:29
RE: Custom JavaScript examples - by sgraystar - 08.04.2024, 07:08
RE: Custom JavaScript examples - by admin - 08.04.2024, 10:11
RE: Custom JavaScript examples - by Joep - 08.04.2024, 13:35
RE: Custom JavaScript examples - by admin - 08.04.2024, 13:36
RE: Custom JavaScript examples - by sgraystar - 09.04.2024, 00:07
RE: Custom JavaScript examples - by iridium - 23.07.2024, 17:07
RE: Custom JavaScript examples - by admin - 24.07.2024, 06:32
RE: Custom JavaScript examples - by iridium - 24.07.2024, 07:55

Forum Jump: