I apologise, I’m a nubie at programming…
I have a dynamic table that uses detail and non-detail fields
I want to hide the entire row of the table if a particular field(s) value is equal to 0.00
Is this possible?
I apologise, I’m a nubie at programming…
I have a dynamic table that uses detail and non-detail fields
I want to hide the entire row of the table if a particular field(s) value is equal to 0.00
Is this possible?
Hi Duncan,
Without knowing the exact specifics, you could use a conditional script within the table similar to the following to hide the row:
if (record.tables.detail[“{field}”] == “0”) {
results.attr(“data-conditional”, “”);
results.hide();
} else {
results.show();
}
Best Regards
Justin Leigh
Technical Support (Asia Pacific)
This can also be handled within an expanded Text Script. The following hides the parent of the table cell (e.g. the row) when the value matches “0.00”.
Erik
results.each(function(index) {
var field, result = "";
field = record.tables["detail"][index].fields["ItemShipped"];
if (field !== "") result += field;
if( field == "0.00") {
result = "";
}
this.html(result);
// Hide the parent (row)
if( field == "0.00") {
this.parent().hide();
}
});
Fantastic, thank you
How would I modify this if I’m looking for the absence of a value in a specific field.
Such as the field ItemShipped = “” or null instead of the “0.00” value in the example?
I have two cases with a similar ask
Simply use if(field)
. That expression returns false
if field
is empty or null.
Sorry for what’s probably a very basic question but I guess I create this as a text script, but then how do I apply it to the row?
It should be matter of assigning a class name to the table cell and use that as the selector for your script. Have a look at the following article: