OL Learn

Hide Entire Rows of Dynamic Table


#1

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?


#2

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)


#3

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();
	}
	
});

#4

Fantastic, thank you