Number Count in Badge With Extra Filters
This is a solution to display a count of the total number of records connected to the logged-in user’s company inside a badge on the menu component.
Step 1
Configure a new pipe with the following settings.
Overview
- GET - https://api.tadabase.io/api/v1/data-tables/TABLE_ID /records?filters[items][0][field_id]= field_XX &filters[items][0][operator]=is&filters[items][0][val]={loggedInUsersCompany}
Parameters
-
Name: Logged In Users Company
-
Slug: loggedInUsersCompany
Headers
-
X-Tadabase-App-id
-
X-Tadabase-App-Key
-
X-Tadabase-App-Secret
Response
- JSON - total_items - Total Items
Step 2
Add an HTML component to your layout; we will configure the pipe inside, as seen in the image below.
Next, add the following source code <> to your component.
<p><span id="html-component-variable">{YOUR_PIPE_VALUE}</span></p>
Remember to insert your pipe value into {YOUR_PIPE_VALUE}. Find your pipe's value in the image below.
Step 3
We will now add the following source code to your menu component for a custom menu item.
Projects <span id="menu-badge" class="badge"></span>
Step 4
Add the following code to the JavaScript tab of the Layout (This appends the text in the HTML component to the span inside the menu item)
$(function(){
setTimeout(function(){
$('#menu-badge').append($('#html-component-variable').text());
},500);
});
Original Community Post:
Number count in badge with extra filters - Community Discussions / Pipes - Tadabase Community
We'd love to hear your feedback.