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 introduced how row clicks work and the options offered within the DataTables Builder. Row click functionality allows us to trigger specific actions when we click on a row in our DataTables report.
In this post, we continue learning about the various integrations built into the DataTables Builder, this time focusing on the On Cell Click. We will also discuss the code and settings differences between row clicks and why you might use one over the over.
Understanding On-Cell Clicks
The unique aspect of cell clicks is that, unlike row clicks, they require no additional configuration options due to the inherent nature of the task. Enabling on-cell click functionality is remarkably straightforward, cell clicks don’t present you with further options to choose from. But why is that the case? To understand this, let’s take a closer look at the underlying code.
The Code Behind On-Cell Clicks
When you trigger a cell click integration in Codence DataTables, the JavaScript code running in the background handles most of the heavy lifting. Here’s a breakdown of how it works:
-
Column Identification:
– The code monitors your interaction with the DataTables report and identifies the specific cell (data) you’ve clicked.
– It locates the cell’s position and determines what “column” was clicked, allowing us to capture the column’s name.
– Additionally, it determines the selected cell’s row and assigns it to the “index” variable.
-
Data Retrieval:
– With the position information in hand, the script calculates the desired cell’s data based on the previously collected column data.
– The result essentially captures the intersection of the column and row’s value, providing you access to the specific data within the clicked cell.
-
JSON Object Creation:
– The code constructs a JSON object containing the “field name” and its corresponding “value” from the selected cell.
– You can pass this object to your FileMaker script, enabling further actions based on this information.
Customizing Your Cell Clicks
While the configuration for cell clicks is minimal, you still have the flexibility to customize certain parameters. In addition to the cell click information, I have created two other JSON elements to pass to FileMaker. These can be modified as you need, but I have found that if you use this approach, you can call the same FileMaker script from your DataTables reports. The FileMaker script works as a controller, parsing the information provided to call specific subscripts. For example, just passing the primary key’s value may not be enough information. By providing the table name or the report name along with the primary key field allows you to take more informed interactions.
You have control over the structure of the JSON object that will be passed to FileMaker. You can expand it with additional attributes to enhance your scripts, remove or modify the default values provided.
Why On-Cell Clicks Matter
On-cell click functionality offers a streamlined way to bring more interaction and control to your DataTables reports. A more common and intuitive approach for users is to click a button to take an action. In the next post, we will experiment by adding a button to each row to perform a FileMaker script. We will also cover the additional settings that allow you to create custom button actions for your users to act upon in your reports.
What’s next?
On-cell click functionality offers a streamlined way to bring more interaction and control to your DataTables reports. A more common and intuitive approach for users is to click a button to take an action. In the next post, we will experiment by adding a button to each row to perform a FileMaker script. We will also cover the additional settings that allow you to create custom button actions for your users to act upon in your reports.
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.
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.