Search for Data
You can also search for specific data in your sheet.
First, structure your HTML the same way you would for displaying data.
Next, set the data-stein-search
attribute of the container to fetch and show only the matching results. Use a JSON string representing the search conditions as its value.
You can additionally limit and offset your results. Refer to this section.
Example
Let's display all posts by Shiven Sinha from our Blog Posts Sheet.
We'd structure the HTML the same way we did for displaying the entire sheet. The only difference is that we add the data-stein-search
attribute to the container.
Here's the updated HTML.
<!-- Filter blog posts by author name -->
<!-- Make sure to use double quotes in JSON strings -->
<div
data-stein-url="https://api.steinhq.com/v1/storages/5cc158079ec99a2f484dcb40/Sheet1"
data-stein-search='{"author": "Shiven Sinha"}'
>
<div>
<h1>{{title}}</h1>
<h6>By {{author}}</h6>
<p>
{{content}}
</p>
<p>Read on <a href="{{link}}">Medium</a></p>
</div>
</div>