Display Addresses in a Single Line in Table Components
Please note that this is now available as a plugin for easier installation. While you can use this document as a reference, the recommended method to add this functionality is through the plugin installation wizard. Learn more about plugins here.
This is a great solution that you can use to display addresses in a table component across a single line as opposed to multiple lines by replacing the line break with a comma and a space.
Step 1
In your data table, double click your address field to add the CSS class of "address."
Step 2
Hover over the info icon of your data table to get the value of your component ID.
Step 3
Add the following code to the JavaScript tab of your page.
Remember to change the component ID of the code to the value of your ID found in step 2.
TB.render('component_3', function(data) {
var addresses = $(".address a"),
x;
for (x of addresses) {
y = x.innerHTML;
x.innerHTML = y.replace(/<br>/g, ", ");
}
});
We'd love to hear your feedback.