What are some solutions for resetting pagination icons to their default settings in material-table for React?

Hey there, I've been working on setting up a front-end display for a table using material-table in React. Everything has been going smoothly until I noticed some strange pagination icons instead of the usual arrows. Here's a screenshot for reference: Weird pagination icons

Does anyone know how I can fix this issue?

Below is the Material Table tag with the attributes that have been included:

<MaterialTable
        title="Title"
        columns={this.state.columns}
        data={newDataTable}
        options={{
          selection: true,
          search: false,
          sorting: true
        }}
        actions={[
          {
            icon: () => <Checkbox />,
            tooltip: 'checkbox'
          },
          {
            icon: () => <InfoIcon />,
            tooltip: 'info',
            onClick: (event, item) => {
              this.setState({
                isOpen: true,
                selectedItem: item
              });
            }
          }
        ]}
      />
    </div>

Answer №1

Once you have installed the MaterialTable component, follow these steps:

Step 1 : Add icons to your index.html

<link
      rel="stylesheet"
      href="https://fonts.googleapis.com/icon?family=Material+Icons"
    />

Alternatively, you can install @material-ui/icons and import it as a component.

Step 2 : Customize your MaterialTable component based on your needs

import React from "react";
import "./styles.css";
import MaterialTable from "material-table";

    export default function App() {
      return (
        <MaterialTable
          title="Simple Action Preview"
          columns={[
            { title: "Name", field: "name" },
            { title: "Surname", field: "surname" },
            { title: "Birth Year", field: "birthYear", type: "numeric" },
            {
              title: "Birth Place",
              field: "birthCity",
              lookup: { 34: "İstanbul", 63: "Şanlıurfa" }
            }
          ]}
          data={[
            { name: "Mehmet", surname: "Baran", birthYear: 1987, birthCity: 63 },
            {
              name: "Zerya Betül",
              surname: "Baran",
              birthYear: 2017,
              birthCity: 34
            }
          ]}
          actions={[
            {
              icon: "save",
              tooltip: "Save User",
              onClick: (event, rowData) => alert("You saved " + rowData.name)
            }
          ]}
        />
      );
    }

Check out the live code here: https://codesandbox.io/s/sharp-robinson-7f6n7

Live demo available at:

Answer №2

The issue here is that your icon is not receiving the correct CSS styling because a link needs to be provided in index.js

<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />

If you want to learn how to use material icons, you can check out material-ui

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

Integrating Material-UI Dialog with Material-table in ReactJS: A Step-by-Step Guide

I have implemented the use of actions in my rows using Material-Table, but I am seeking a way for the action to open a dialog when clicked (Material-UI Dialogs). Is there a way to accomplish this within Material-Table? It seems like Material-UI just appen ...

Obtaining the most recent state information within a functional component

I'm encountering an issue with obtaining the updated state data within a functional component. While I've come across threads on SO suggesting switching to a Class component for better state management without hooks, I believe it should be achiev ...

Why does my Redux callback keep getting invoked multiple times?

In developing a react application with redux, I have chosen to avoid using react-redux by manually handling all dispatched events. Below is a sample code snippet. The content of index.html <!DOCTYPE html> <html> <head> <script src=& ...

Having trouble with my Nextjs weather app attempting to fetch an API. Unsure of what I am doing incorrectly as I keep receiving an unauthorized error

Is my API handling implementation correct? Or could there be something crucial that I am overlooking? Originally, this project was created using a React app and now I am attempting to transition it to Next.js, so maybe there is something specific about how ...

What are the steps to implement background synchronization in place of making fetch requests upon UI changes?

Consider this scenario: A straightforward web application with a comments feature. In my view, when a user submits a comment, the following steps would typically unfold: Show UI loader; Update the front-end state; Send a fetch request to the API to post ...

Unable to retrieve button value with material-ui package

My task requires me to retrieve the value of a button, as it contains an ID essential for further steps. Initially, I used a standard button with Bootstrap styling and everything functioned correctly. <button value={row.vacationRequestID} c ...

Altering the context value in React does not trigger a re-render of the main page

I've set up a system using context to manage my theme across different pages. The darkMode context that controls the theme in index.js is supposed to be changed by a button in the NavBar. However, it seems like the darkMode variable is not updating ...

Having difficulty in utilizing localStorage to update the state

I've attempted to log back in using the stored credentials, however it's not working despite trying everything. The dispatch function is functioning properly with the form, but not when accessing localStorage. App.tsx : useEffect(() => { ...

Emphasize specific letters in a word by making them bold, according to the user

In my app, there is a search feature that filters data based on user input and displays a list of matching results. I am trying to make the text that was searched by the user appear bold in the filtered data. For example, if the user searches 'Jo&apos ...

Developing the headers for a service using React.js

As someone new to ReactJs, I'm curious about the various methods we can use to include Headers in our service Url before making a call. While I'm familiar with how GET/POST Calls are made in angular Js after including headers, I'd like to l ...

The React Router test commences outside of the home page

While testing my App component, I encountered an issue during the second test. In the first test, the process begins from the home page where I click on a drink-preview to access a recipe. However, in the subsequent test, which is expected to follow the sa ...

I'm looking for a way to dynamically update Laravel pagination records based on the selected option value for the number of items per page using Laravel and

I am working on creating a custom filter system using a select option menu and pagination with AJAX. The select option allows users to choose between displaying 10, 15, 20, or 25 products per page while updating the Laravel default pagination dynamically ...

Experiencing challenges accessing information from the useEffect hook in React

I'm facing some issues with my useEffect hook and I can't seem to figure out why it's not working. I've been trying to make a call to an endpoint, but it seems like I'm not getting any response back. Any help would be greatly appr ...

Steps for eliminating the chat value from an array tab in React

tabs: [ '/home', '/about', '/chat' ]; <ResponsiveNav ppearance="subtle" justified removable moreText={<Icon icon="more" />} moreProps={{ noCar ...

The issue of duplicate marks in MUI range sliders arises when there are two children that share identical keys

There seems to be a bug in the mui range slider where the marks get duplicated when both thumb sliders are moved all the way to the right. Initially, the slider looks like this: When both thumbs are slid to the far right, an error message appears in the ...

Proper method for managing errors in getServerSideProps within Next.js

I am currently facing an issue with handling errors that are being caught in getServerSideProps. Everything works smoothly until I introduce other hooks like useEffect. The problem arises when using the useEffect hook, as it triggers the following error - ...

"Introducing the new Next.Js 14 sidebar featuring a sleek hamburger menu

I am in the process of developing a chat application. Currently, I have a sidebar that displays existing conversations and I would like to make it responsive by implementing open and close functionalities for mobile devices. Here is the code snippet for m ...

Enhancing Backstage with Material-UI Theme Overrides using `withStyles`?

I am currently trying to customize the styling of a component in Material-UI that has been styled using withStyles. Upon inspecting the DOM, I noticed that the MuiSelect component within the Backstage application has had its styles overridden through CSS c ...

The Link component in the router dom should only be active when validation passes successfully

I am looking for a way to prevent the Link component in react-router-dom from functioning until all validations are successfully completed. Removing the link allows the validation to work as intended. I have come across something related to ifValidate, bu ...

Encountering the issue of react-router peerDependencies not being

I am encountering an issue while attempting to install react-router as I receive the following error message. $ npm install react-router npm WARN peerDependencies The peer dependency <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfem ...