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.
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.