BUG or what?
Hi to all!
i am experimenting a simple dashboard formatting fields in a CSS way:
the problem is when I go out form this and open a new table:
you can see the consequences
if I refresh the page:
all comes back to normal.
Have you experienced this?
thank you for attention
17 replies
-
Can you post a small example database that demonstrates this behavior?
-
sure.
let currentTable := tableId(this);
if currentTable = "RC" then
let HR := cnt(select Album where Genres like "Hard Rock");
html("
<script>
var HR = '" +
HR +
"';
var fields = document.querySelectorAll('label');
fields.forEach(function (field) {
if (field.innerText === 'Hard Rock') {
field.style.fontFamily = 'Verdana';
field.style.fontSize = '10px';
field.style.color = 'black';var currentField = field.nextElementSibling;
currentField.textContent = HR;
currentField.style.border = '2px solid red';
currentField.style.padding = '2px';
currentField.style.background = 'radial-gradient(circle, red 30%, white)';
currentField.style.width = '120px';
currentField.style.height = '120px';
currentField.style.textAlign = 'center';
currentField.style.lineHeight = '120px';
currentField.style.fontFamily = 'Helvetica';
currentField.style.fontSize = '22px';
currentField.style.color = 'white';
currentField.contentEditable = true;
} else {
var currentField = field.nextElementSibling;
currentField.style = ''; // Rimuove eventuali stili applicati precedentemente
}
});
</script>
")
endthis script is assigned to the formula itself. To prevent this behavior I am now going to create a new formula field that refers to the field labelled "Hard Rock", but in this case it will be not a formula but a normal field
-
said:
To prevent this behavior I am now going to create a new formula field that refers to the field labelled "Hard Rock", but in this case it will be not a formula but a normal fieldSo, is that an acceptable workaround for you?
-
unfortunately not, I will try something new inn these days
-
I cobbled a test database together and I got similar results. I'm guessing that you use that formula in each of the genre Formula fields. I had to remove the "else" in the "Progressive Rock" Formula field because it would reset the formatting for the "Hard Rock" Formula field. Also, I got the effect you got in your screenshots only in Table view, but your screenshots look like Form view. Plus, if I alternately select tables in the side bar while in Table view the Mac app hangs.
Anyway, your code is negatively interacting with Ninox code and I don't think it's necessarily a bug. If I comment out all of the code related to the nextElementSibling property there aren't any issues. I've attached my test database.
-
Sean thank you for all your effort! I'll write here if something get better
-
oh I almost forgot Sean: excellent choice of Hard Rock and Progressive Rock in your test database!
-
i have made some changes
-
formula field "Hard Rock":
let HR := cnt(select Album where Genre like "Hard Rock");
html("<h1 style='border: 2px solid red; padding: 45px; background: radial-gradient(circle, red 30%, white); fontFamily: Helvetica; font-size: 30px; color: white; text-align: center;'>" +
HR +
"</h1>")formula field "Progressive Rock"
let PR := cnt(select Album where Genre like "Progressive Rock");
html("<h1 style='border: 2px solid green; padding: 45px; background: radial-gradient(circle, green 30%, white); fontFamily: Helvetica; font-size: 30px; color: white; text-align: center;'>" +
PR +
"</h1>")i introduced the h1 tag that seems to avoid the problem I had
-
this is associated to the formula field called "genre not Assigned".
let TE := cnt(select Album where Genre = null);
html("<button id='button1'>" + TE +
"</button><meta charset='utf-8'/><meta name='viewport' content='width=device-width, initial-scale=1'>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
background-color: #f7f7f7;
}button {
border: none;
background-color: orange;
background: radial-gradient(circle, orange 30%, white);
border: 2px solid orange;
padding: 2px;
width: 120px;
height: 120px;
text-align: center;
line-height: 120px;
font-family: Helvetica;
font-size: 22px;
color: white;
outline: none;
cursor: pointer;
border-radius: 5px;
}
</style>")added this to onclick action:
openTable("Album", "GenreNull")
obviously I created a new view of Table Album with the genre criteria on it.
I don't know if I understood well what you are saying, if not sorry, my English is not so good
-
how to add for example that button called "clean fields"
formula:
let CL := "Clean Fields";
html("<h1 style='border: 2px solid darkmagenta; padding: 10px; background: radial-gradient(circle, mediumorchid 30%, darkmagenta); fontFamily: Helvetica; font-size: 10px; color: white; text-align: center;'>" +
CL +
"</h1>")onclick:
Date := null;
Numero = 0;
'Artist Name' := null;
Release := null;
Label := null;
Format := null;
Country := null;
'Year Released' := null;
Style := null;
'Last Sold' := null;
'Lowest Price' := null;
'Medium Price' := null;
'Highest Price' := null;
Tracklist := null;
Number := null
Content aside
- Status Answered
- 1 yr agoLast active
- 17Replies
- 209Views
-
2
Following