Master DataTables Series: 4.4 Adding a Button On-Click to a Row

by Jody Barney - Application Developer

Welcome to the multi-part video series that will teach you how to implement DataTables in your Claris FileMaker Pro solutions effectively. If you’re new to this series, we recommend starting from the introduction to maximize your learning experience. You can access the complete series here: Master DataTables with Claris FileMaker Pro.

In the previous post, we explored how cell clicks work and why you may want to use this option over another type of integration.

In this post, we continue learning about the various integrations, changing our focus to Button Clicks.  Adding a button to each row of your DataTables report can enhance the user experience and provide a clear way to trigger specific actions.

Configuring Button Clicks

To begin adding button clicks to your DataTables report, you’ll need to access the gear icon in the Integration tab of the Builder. Choose the “Button Click” option to get started. As with row and cell clicks, you’ll be presented with integration options, but there are a few additional options we have not seen yet.

Button Click Similarities

Like On Click Rows, when you select “Each Row” for button clicks, you have two choices: “Entire Row” or “Specific Value.” This choice determines what your button click action will return to your FileMaker script. You can either return the entire row of data or a specific value. This flexibility allows you to tailor your interaction to suit your application’s needs.

The actual code for button clicks in Codence DataTables is quite similar to that of row clicks. When you choose “Entire Row,” you’re simply passing the entire row as your object, making it accessible to your FileMaker script. However, when you opt for “Specific Value,” you’ll be passing only the value you’ve specified.

Button Click Differences

The main difference in the code is that it employs a JavaScript function called “button_on_click” to manage the interaction. Both the row and cell clicks were able to use the underlying data to trigger the integration event.  However, button clicks require us to “build” a button for the user to interact with, it does not exist from our dataset.   Let’s explore how we do this.

The Visual Impact: Adding Buttons

Adding a button to your DataTables report involves creating a new column. This is akin to how we manage other columns in the report. The key difference is that, while your data fields originate from the report’s data source, buttons must be created as a new column to appear on the report. When you choose the button integration for a row, the code behind the scenes essentially builds this column for you.

Button Labeling and Placement

When this new column is first created, it comes with some default values for it to properly appear on the report.  However, just like any other column, by accessing the Column’s Builder, you can control the visibility, column’s title and other setting we have learned about when modifying columns. You also have complete control over the button’s label, allowing you to customize it to align with your application’s needs. Additionally, you can adjust the position of this new column to determine where the button appears within the table.

Customizing and Stylizing

Button clicks offer a powerful way to engage with your data and trigger actions within your FileMaker solutions. The ability to return specific values or entire rows, coupled with custom labeling and placement, allows you to fine-tune your user experience. In future series, we’ll explore additional aspects of buttons, including how to style and format your buttons, adding even more depth and functionality to your DataTables reports.

What’s next?

In the final post of this series, we expand on the button click options in the DataTables Builder.  We learned how to add a button to each row of the table, but now we are going to look at adding a button to the entire table.  Although similar in code, there are fundamental differences between the two options.  We’ll learn about those difference and why you would want to use one over the other.

Join the Training Series Now

Subscribe to our YouTube channel to keep up with the video training series. Comment on the YouTube videos to interact with us and share your thoughts and questions. Also, don’t forget to join our mailing list for updates on new videos and additional resources.

Please enter your contact information to download the Demo file.

This field is for validation purposes and should be left unchanged.

Leave a comment

Your email address will not be published. Required fields are marked *

Your email address will not be published. Required fields are marked *

Built with you in mind

Speak to one of our expert consultants about making sense of your data today. During
this free consultation, we'll address your questions, learn more about your business, and
make some immediate recommendations.


Stay in touch!

This field is for validation purposes and should be left unchanged.