Path: blob/main/doc/how_to/custom_components/examples/table_viewer.md
2012 views
How to Create Reactive Tables with Panel
This guide will walk you through creating reactive tables using Panel's powerful reactive programming paradigm. You'll learn how to use Python methods, parameter dependencies, and caching to build interactive and efficient data visualizations.
Introduction
Panel's reactive programming paradigm allows you to create dynamic applications that respond to user input. By leveraging Python methods, parameter dependencies, and caching, you can efficiently update views without unnecessary recomputation.
In this guide, we'll demonstrate how to create a reactive table viewer component. This component will allow users to select different datasets and control the number of rows displayed.
Step-by-Step Guide
Step 1: Import Required Libraries
First, import the necessary libraries:
Step 2: Define the Viewer Class
Create a class ReactiveTables
that inherits from Viewer
. This class will manage the dataset selection and row display:
Step 3: Serve the Application
Finally, make the ReactiveTables
class servable:
Conclusion
By following this guide, you've created a reactive table viewer using Panel. This application allows users to interactively select datasets and control the number of rows displayed, with efficient updates based on parameter changes.
Feel free to experiment with different datasets and parameters to further explore Panel's capabilities.
Additional Notes
The
max_items=3
argument in@pn.cache
is an example. You can adjust this value or explore other supported arguments to suit your needs.