Design a Bootstrap dropdown menu featuring various options within an icon container

I have designed a blade with a signboard containing multiple columns, each displaying its name, color, and assigned cards (screenshot). To enable sorting of these cards, I added an icon next to each column title. My goal is to allow users to select sorting options by clicking on the sort-icon.

I attempted to implement this functionality by including a hidden select element and using .selectpicker('toggle') to toggle it upon clicking the icon, but unfortunately, this approach did not work as expected.

The foreach loop below showcases the code, where $statuses represents the values for the columns obtained from the controller.

<div class="card-header" style='border-bottom: 3px solid {{ $status->color }}'>
    <div class="row">
        <div class="col-10">
            <h5 class="card-category h3 mb-0" style="display: inline">{{ $status->name }}</h5>
            <span class="small material-icons" style="display: inline">sort</span>
        </div>
        <div class="col-2">
            <small class="totalCandidates mt-0 float-right"></small>
        </div>
    </div>
</div>

In summary, my query is whether there is a way to utilize an icon instead of a traditional select box to display sortable options?

Your assistance or suggestions are highly appreciated. Should this be impossible, kindly let me know so that I can explore alternative solutions.

Many thanks in advance!

EDIT

Following the advice from Bernhard Beatus's answer, I have updated my card header:

<div class="card-header" style='border-bottom: 3px solid {{ $status->color }}'>
    <div class="row">
        <div class="col-10">
            <ul class="nav nav-pills">
                <h5 class="card-category h3 mb-0" style="display: inline">{{ $status->name }}</h5>
                <li class="nav-item dropdown pl-1">
                    <a data-toggle="dropdown" href="#"><span class="small material-icons">sort</span></a>
                    <div class="dropdown-menu">
                        <a class="dropdown-item" href="#">Name</a>
                        <a class="dropdown-item" href="#">Status</a>
                        <a class="dropdown-item" href="#">Position</a>
                        <a class="dropdown-item" href="#">Creation date</a>
                    </div>
                </li>
            </ul>
        </div>
        <div class="col-2">
            <small class="totalCandidates mt-0 float-right"></small>
        </div>
    </div>
</div>

This modification now displays a dropdown menu instead of a select box, which will suffice for the time being.

Answer №1

A new Icon has been added.
Discover the fiddle created for you: https://jsfiddle.net/bogatyr77/1xfwjq6c/2/

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" rel="stylesheet" />
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="57353838232423253627176379617967">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<div class="col pl-1 pr-1">
  <div class="card bg-transparent h-100">
    <div class="card-header" style='border-bottom: 3px solid {{ $status->color }}'>
      <div class="row">
        <div class="col-10">
          <ul class="nav nav-pills">
            <h5 class="card-category h3 mb-0" style="display: inline">{{ $status->name }}</h5>
            <li class="nav-item dropdown">
              <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false"><i class="fas fa-filter"></i></a>
              <div class="dropdown-menu">
                <a class="dropdown-item" href="#">Action</a>
                <a class="dropdown-item" href="#">Another action</a>
                <a class="dropdown-item" href="#">Something else here</a>
                <div class="dropdown-divider"></div>
                <a class="dropdown-item" href="#">Separated link</a>
              </div>
            </li>
          </ul>
          <span class="small material-icons" style="display: inline"></span>
        </div>
        <div class="col-2">
          <small class="totalCandidates mt-0 float-right"></small>
        </div>
      </div>
    </div>
    {{-- utilizes jQuery to display corresponding cards --}}
    <div class="card-body kanbanColumn" data-status='{{ $status->id }}'></div>
  </div>
</div>
<div id="candidateModal"></div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Asp.Net feature for adding comments

I currently have a page where users can leave comments, which are then stored in a database table. When the user submits a comment, it is displayed on a datagrid after a postback. However, I would like to enhance the presentation of these comments and ma ...

"Enhance Your Website with Dual Functionality Using JQuery's One

I am trying to run two functions on a click event. Each function works fine on its own. However, I am encountering an issue when I execute functionA followed by functionB. The problem seems to be originating from functionB. I suspect it is because of the ...

What is the most effective method for a div to cover multiple table cells simultaneously?

Struggling to understand how a calendar web page using jQuery and asp.net-mvc similar to this example supports events that span multiple days with the event displayed across multiple cells in the table view. Upon inspecting the code using firebug, it appe ...

Refresh Layers in Openlayers with LayerRedraw(), Rotate Features, and Manipulate Linestring Coordinates

TLDR: I am facing difficulties with my OpenLayers map. Specifically, I want to remove and add a layer called 'track', or find a way to plot a triangle based on one set of coordinates and a heading (see below). In my OpenLayers map, there is an i ...

Ways to insert user data into a hidden input field

I am facing an issue with the input field on my website. Users can enter their desired input, and this data is copied into a hidden input field. However, the problem arises when new data replaces the old data. This is where I copy all the data: $('# ...

Customize the keyboard on your iPod by replacing the default one with a

Looking to customize the iPOD keyboard to only display numbers, similar to a telephone keypad: https://i.stack.imgur.com/X0L3y.png The current iPOD default keyboard looks like this: https://i.stack.imgur.com/VykjU.png ...

"Partially loaded" when document is ready

Is there a way for me to trigger a function once the element identified by #container has finished loading in the DOM? Instead of waiting for the entire DOM to load using document.ready(), I'd like to start populating #container right after it's ...

I am experiencing difficulties with certain images not appearing on my website

Everything was running smoothly while I was working on my website locally. However, as soon as I uploaded it online, some of the images refused to load and are now missing. I built my website using wordpress version 3.7.1. If you'd like to take a loo ...

The dimensions of the cards adjust automatically when the flex direction is set to row

My cards, created in CSS and React.js, have a set height and width. However, when I change the flex direction from column to row, the cards automatically shrink in size. Why is this happening? Card's CSS and JS code CSS .card{ height: 50%; w ...

Encountered an unforeseen issue: Unexpected character : within jQuery Ajax

After successfully setting up a REST web service in Java that delivers data in "application/json" format, I encountered an issue while attempting to access the REST data from my Windows machine using jQuery $.ajax. The web service is hosted on a separate L ...

When HTTP 304 meets the Cache-Control directive with a value of no-cache

I'm encountering the following response from certain web server requests: First request: HTTP/1.1 200 OK Date: Mon, 16 Jan 2012 05:46:49 GMT X-Powered-By: Servlet/2.5 JSP/2.1 Content-Type: text/plain Content-Length: 78 Content-Encoding: gzip Etag: " ...

What could be the reason that my Javascript function is not displaying in the HTML document?

I'm currently working on developing an HTML page that displays random quotes by Mark Twain. The function and array of quotes are set up in a separate Javascript file which is linked to the main HTML document. However, I am facing an issue where the ou ...

AJAX function in Chrome console is throwing an error message stating "Unexpected Token }"

Dealing with this issue has been quite unusual for me. I've spent the last 3 days trying to troubleshoot it, but now it's no longer bothering me. The situation involves a button and a textbox that sends the data from the textbox to a PHP page whe ...

Web Audio API functions are encountering a playback issue on iOS 13.3, despite working smoothly on previous iOS versions

I have been developing an audio visualizer using the web audio API. It was functioning smoothly on PC, however, after upgrading to iOS 13.3, it no longer operates on Apple mobile devices. The root cause of this issue remains a mystery to me. The problem s ...

Ajax: What could be causing the post request to be triggered twice?

I am puzzled by the fact that my request is being sent twice, without any clear reason. Here is the code for my simple form: <form method="POST" class="mb-4" autocomplete="off" action="/recipe/add" novalidate id="form"> <div class="form-grou ...

Comparison of HTML's equivalent to LaTeX's label and ef functionality

I have a Frequently Asked Questions page coded in HTML (example) where the questions often refer to one another. This results in the numbering changing whenever we add, delete, or rearrange the questions. LaTeX provides an elegant solution to this problem ...

Adjust the paragraph font size within the bootstrap stylesheet

We currently utilize the bootstrap v2 CSS and are interested in globally increasing the font size by a point or two. I am wondering if this adjustment is a straightforward modification within the CSS file or if it requires a more complex approach. After a ...

PHP not receiving values when making an AJAX POST request

My AJAX file below is where I pass all the values from my text boxes and post them to edu.php. In edu.php, I intend to update two tables - details and test. However, nothing seems to be updating in my database. When I checked the values with var_dump, the ...

Stopping individuals from engaging in the act of spamming a picture upload form

I am currently developing an innovative Image hosting platform, and I am faced with a crucial challenge – how can I effectively prevent users from continuously refreshing the form, causing the image to be repeatedly uploaded until my disk space allocat ...

Using Angular to scroll within a <div> that is obstructed by other <div>s and concealed by

I am currently in the process of developing a website using Angular. I have implemented a card feature that allows for text selection from a menu on the left side. The texts are displayed using the *ngIf directive. However, I encountered an issue where if ...