Tips for utilizing icons instead of buttons with ng2smart table

I have a query regarding ng2 smart table. I would like to replace buttons with icons for functionalities such as AddNew row, edit, delete, update, create, and cancel. Additionally, I am looking to include a checkbox in one of the columns in my table. Can anyone provide me with a solution at the earliest convenience?

Answer №1

Instead of using text in the ButtonContent of table settings, you can opt for icon tags.

settings = {
    delete: {
      confirmDelete: true,

      deleteButtonContent: '<i class="fa fa-trash" style="font-size:32px"></i>',
      saveButtonContent: 'save',
      cancelButtonContent: 'cancel',

    },
    add: {
      confirmCreate: true,
      addButtonContent:'<i class="fa fa-plus" style="font-size:32px"></i>'
    },
    edit: {
      confirmSave: true,
      editButtonContent:'<i class="fa fa-edit" style="font-size:32px"></i>'
    },
    columns: {
      id: {
        title: 'ID',
      },
      name: {
        title: 'Full Name',
      },
      username: {
        title: 'User Name',
      },
      email: {
        title: 'Email',
      },
    },
  };

Check out this example to see it in action

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

Generate a series of buttons with generic identifiers that can be easily targeted using getElementById. The IDs will be dynamically assigned

I am looking to dynamically generate unique IDs for a list of buttons, allowing me to easily target specific buttons using getElementById. Here is an example code snippet where each button has the same ID: @foreach (var cat in Model) { <div clas ...

Struggling to properly position a checkbox within an Angular Material project

<div class="checkbox-password"> <div> <mat-checkbox class="example-margin">Remember me</mat-checkbox> </div> <div> <a routerLink="/forgotPassword" class="createAccount" ...

Adding existing tags to Select2 in Angular2 can be accomplished by following these steps:

HTML: <select data-placeholder="Skill List" style="width:100%;" class="chzn-select form-control" multiple="multiple"> <option *ngFor="#skill of allSkills" [ngValue]="skill">{{skill}} </option> </select> TS: allSkills = [& ...

The challenges and benefits of using jQuery for background positioning compared to CSS animation positioning

I am currently developing a website where the main section has a series of divs with looping background images, and I am utilizing jQuery to animate their movement in order to create an illusion of an "ocean" of images flowing across the screen. let pos ...

Begin an HTML document by loading it with xml.Load

I am looking to access an HTML document stored as a string retrieved from a StreamReader on the web and then convert it into an XMLDocument. Currently, I am using the following code: XmlDocument doc = new XmlDocument doc.Load(string containing the retrie ...

I am experiencing an issue where the custom form validation directive in AngularJS is not functioning properly within my modal

To enhance the validation of my input boxes, I created a custom directive called nx-validate. This directive is designed to be added to a bootstrap div.form-group, which will then check if the <input/> field is $dirty or $invalid, and apply the appro ...

Switching images between mobile and desktop view in responsive mode is a useful feature for optimizing

Within a specific folder structure, I have a collection of images designated for both desktop and mobile displays: img: img-1.png img-2.png img-3.png img-4.png img-5.png img-6.png img/mobile: img-1.png img-2.png ...

"Step-by-step guide to layering an HTML element on top of another with CSS

I am facing an issue with positioning a small icon over a slider using HTML and CSS. The problem arises because both the slider and the icon have a position absolute, causing the slider to hide the icon. Here is the CSS code for the icon: #nav { po ...

How can I dynamically update an img src using JavaScript on a PHP webpage?

I have a PHP page where I display image thumbnails. I am trying to implement a feature where the thumbnail expands in another image on mouseover. Here is the PHP code snippet: echo "<tr><td><a href='$imgrow[location]' target=&ap ...

Troubleshooting a MySQL problem with updating a large quantity of HTML content

I've integrated autosave functionality using Ajax into my content management system. However, I've encountered a problem. The issue arises when I test the system on my local server - the PHP side updates large amounts of data smoothly. But when I ...

What is the best way to trigger the second function on a click event?

Is there a way to trigger my 20 second timer with the click of a button, followed by an alert after the timer ends? HTML <aside class="start-box"> <button type="submit" class="btn btn-primary btn-lg" id="toggleBtn" onclick="startCloc ...

Can you provide an example of a valid [routerLink] for a relative auxiliary route?

Suppose I have the following route configuration: { path: 'contact', component: ContactComponent, children: [ { path: ':id', component: ContactDetailComponent }, { path: 'chat', component: ContactChatComponent, outlet ...

Javascript - Implement validation pattern requiring a minimum of one character that is not a space

I am looking to create an input field with a validation pattern that does not allow spaces. While I found a solution that includes a pattern for alphanumeric characters and spaces, it does not account for special characters such as č, ć, ž, đ, š, and ...

Animating number counters in Ionic 3 with Angular

Displayed in my user interface is a simple number, nothing fancy. <ion-label>{{myCount}}</ion-label> Next to the number, there is a button labeled "reset." When pressed, the counter resets to 0. This functionality works well with a basic func ...

Guide on adjusting canvas height to match Full Document height (covering entire page)

Hello everyone, I'm getting in the holiday spirit by adding some snow falling effects using Canvas and it looks pretty awesome. The only issue is that it's filling up the entire screen due to: c.width = innerWidth; c.height = innerHeight; If a ...

What is the method for altering the background color of an HTML table cell when a particular event occurs?

As I create an html table, I am looking to dynamically change the background color of specific boxes after running a selenium webdriver. For instance, if the webdriver successfully navigates the site, I want the corresponding box in the table to turn gre ...

Angular tutorial: Display EmployeeName on Label by verifying EmployeeCode

Within my Angular-14 project, I am working with the following code: component.ts: constructor( private fb: FormBuilder, private employeeService: EmployeeService, private bsModalRef: BsModalRef, private modalService: BsModalService ) { ...

I'm working on separating the functionality to edit and delete entries on my CRM model, but I'm having trouble finding a way to connect these buttons with my data fields

I am encountering some difficulties while trying to implement separate functionality for editing and deleting items on my CRM model. I have already created the necessary API in Angular, but I am struggling to bind these buttons with my field. Any assistanc ...

TinyMCE version 5.x - Stand out with a specific selection in a personalized drop-down navigation bar

In my customized TinyMCE 5.x dropdown menu, there are 3 options that adjust the width of the editor. I am looking for a way to indicate the currently selected option, but I am unable to interact with the menu items once they are initialized. It seems like ...

Explore the item and extract the data within Angular elements

I received the following data exactly as shown: { "packBarCode":"Q122344", "usedQty":11, "description":"Box of Chocs", "customerName":"Retail Mart" } via an API and stored it in an Array[] within my customerComponent.ts file. How can I access th ...