in Education by
EDIT : This issue also concerns Material Ui's Data table. I tried using the same example as given by the documentation but the same problem occurs. I have been battling with an issue regarding the provided selection feature where, when I click on a select, the box ripples, but does not get selected (no checkmark). The weird thing is that when I tried to create a code sandbox using the same components, everything worked just fine. I'm unsure how to debug this, but it seems that the environment is the cause. I have forked the material-table-core/core project, and I am planning to do some debugging on there, but don't necessarily know where to look. Thought maybe some bored soul could offer some guidance here ? It should be noted that if I try to control the checked state from "outside" of the table like instructed in this issue, the selection works just fine. Here is a gif of the behavior : The website is a PHP/contao legacy app on a Linux remote server with a lot of jquery all over the place, we recently decided to start using react and deprecating our jquery code gradually. I am currently using a fork of @material-table/[email protected]. But no changes to the fork have been made yet. I just want to use it as a debugging tool. As you can assume, react/webpack and babel have been manually installed and configured (not using CRA). To understand how react is loaded, take a look at the following files (stripped of all irrelevant code for clarity) : Index.html5 : (most of these script tags are needed for the old legacy app) <!DOCTYPE html> .js"> <!-- //! upgraded --> .js" type="text/javascript" charset="utf-8"> <!-- //! upgraded --> " type="text/javascript"> " type="text/javascript"> " type="text/javascript"> Chart.plugins.unregister(ChartDataLabels); <?php include_once 'dist/styles.html5'; ?> ..html/scripts <!-- Load our Bundled js files. Unbundled files can be found in : ./react/src/Index.js --> <?php include_once 'dist/main.html5'; ?> Index.js : import React, { StrictMode } from "react"; import { render } from "react-dom"; import "./Index.css"; import TimeTrackingTable from "./TimeTrackingTable"; const timeTrackingTable = document.getElementById( "time_tracking_react_component" ); if (timeTrackingTable) { // console.log("timeTrackingTable", timeTrackingTable); render( {/* */} {/* */} , timeTrackingTable ); } Timetracking component : import React, { useState, forwardRef } from "react"; import MaterialTable from "@material-table/core"; import { Switch } from "@mui/material"; import { AddBox, ArrowUpward, Check, ChevronLeft, ChevronRight, Clear, DeleteOutline, Edit, FilterList, FirstPage, LastPage, Remove, SaveAlt, Search, ViewColumn, } from "@mui/icons-material"; const tableIcons = { Add: forwardRef((props, ref) => ), Check: forwardRef((props, ref) => ), Clear: forwardRef((props, ref) => ), Delete: forwardRef((props, ref) => ), DetailPanel: forwardRef((props, ref) => ( )), Edit: forwardRef((props, ref) => ), Export: forwardRef((props, ref) => ), Filter: forwardRef((props, ref) => ), FirstPage: forwardRef((props, ref) => ), LastPage: forwardRef((props, ref) => ), NextPage: forwardRef((props, ref) => ), PreviousPage: forwardRef((props, ref) => ( )), ResetSearch: forwardRef((props, ref) => ), Search: forwardRef((props, ref) => ), SortArrow: forwardRef((props, ref) => ), ThirdStateCheck: forwardRef((props, ref) => ), ViewColumn: forwardRef((props, ref) => ), }; export default function TimeTrackingTable() { return ( <> { console.log("rows", rows); console.log("e", e); }} detailPanel={({ rowData }) => { return ; }} /> {" "} </> ); } function RenderDetails({ rowData }) { const [detailDataRow, setDetailDataRow] = useState({ ...rowData }); return ( , }, ]} data={detailDataRow.PartnerMenuItems} style={{ backgroundColor: "aliceblue", }} options={{ selection: true, }} onSelectionChange={(rows) => alert("You selected " + rows.length + " rows") } /> ); } const menuSections = [ { name: "Salads", PartnerMenuItems: [ { name: "Farmers Salad", active: true, }, { name: "Goat Cheese", active: true, }, { name: "Champagne Vinaigrette", active: true, }, { name: "Romaine Salad", active: true, }, { name: "Cilantro Parmesan Dressing", active: true, }, { name: "Asian Inspired Salad", active: true, }, { name: "Cilantro Ginger Vinaigrette", active: true, }, { name: "Beet Citrus Salad", active: true, }, { name: "Maple Thyme Vinaigrette", active: true, }, ], }, .. etc i wont include all data here so not make the post too long ]; function SelectOutsideOfTable() { const [data, setData] = useState([ { fruit: "Apple", id: 0, }, { fruit: "Orange", id: 1, }, ]); const toggleRowChecked = (row) => { return row.tableData && row.tableData.checked ? !row.tableData.checked : true; }; const toggleSelectAll = () => { const newData = data.map((row) => ({ ...row, tableData: { checked: toggleRowChecked(row), }, })); setData(newData); }; const columns = [ { title: "Fruit", field: "fruit", }, { title: "ID", field: "id", }, ]; return (
); } Package.json dependencies : "devDependencies": { "@babel/core": "^7.15.8", "@babel/preset-env": "^7.15.8", "@babel/preset-react": "^7.9.4", "babel-loader": "^8.2.2", "clean-webpack-plugin": "^4.0.0", "css-loader": "^6.4.0", "css-minimizer-webpack-plugin": "^3.1.1", "html-webpack-plugin": "^5.4.0", "html-webpack-skip-assets-plugin": "^1.0.3", "jquery-migrate": "^3.3.2", "mini-css-extract-plugin": "^2.4.3", "react-json-view": "^1.21.3", "style-loader": "^3.3.1", "webpack": "^5.59.1", "webpack-bundle-analyzer": "^4.5.0", "webpack-cli": "^4.9.1", "webpack-merge": "^5.8.0" }, "dependencies": { "@emotion/react": "^11.7.1", "@emotion/styled": "^11.6.0", "@material-table/core": "https://github.com/HRpuls/core.git#dist", "@material-ui/core": "^4.12.3", "@material-ui/data-grid": "^4.0.0-alpha.37", "@material-ui/styles": "^4.11.4", "@mui/icons-material": "^5.1.0", "@mui/lab": "^5.0.0-alpha.56", "@mui/material": "^5.2.8", "@mui/styled-engine-sc": "^5.1.0", "@mui/styles": "^5.2.3", "@mui/x-data-grid": "^5.2.2", "axios": "^0.24.0", "bootstrap-table": "^1.19.1", "chart.js": "^3.6.2", "chartjs-plugin-datalabels": "^2.0.0", "date-fns": "^2.27.0", "jquery": "^3.6.0", "jquery-ui": "^1.13.0", "jspdf": "^2.5.0", "jspdf-autotable": "^3.5.23", "moment": "^2.29.1", "moment-range": "^4.0.2", "react": "^17.0.2", "react-bootstrap": "^2.0.2", "react-chartjs-2": "^4.0.0", "react-csv": "^2.2.1", "react-dom": "^17.0.2", "react-highlight-words": "^0.17.0", "react-hook-form": "^7.21.0", "react-player": "^2.9.0", "react-redux": "^7.2.6", "react-router-dom": "^6.1.1", "react-spinners": "^0.11.0", "react-swipeable-views": "^0.14.0", "react-table": "^7.7.0", "react-video-js-player": "^1.1.1", "redux": "^4.1.2", "redux-logger": "^3.0.6", "redux-promise-middleware": "^6.1.2", "redux-thunk": "^2.4.1", "signature_pad": "^4.0.1", "styled-components": "^5.3.3", "use-debounce": "^7.0.1" } JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
The problem was caused by css. Found some legacy code that gave all checkboxes inputs the following : [type="checkbox"]:not(:checked), [type="checkbox"]:checked { left: -99999px !important; } input[type="checkbox"], input[type="radio"] { width: auto; } So I just needed to set those values to their initial state and that did the trick.

Related questions

0 votes
    I have to put an input on the site from Excel file which I have done successfully. The only thing i got stuck ... as per the Excel file Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
0 votes
    I have to put an input on the site from Excel file which I have done successfully. The only thing i got stuck ... as per the Excel file Select the correct answer from above options...
asked Feb 5, 2022 in Education by JackTerrance
0 votes
    I'm using VB code created by L42 on 4/27/14 that creates a checkbox list in a single cell. ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 11, 2022 in Education by JackTerrance
0 votes
    I'm trying to create a little popup-menu that displays a series of checkboxes to the user in Java ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 19, 2022 in Education by JackTerrance
0 votes
    When you click on a table, a plus sign is appear which is known as ____________. Select the correct answer from above options...
asked Dec 24, 2021 in Education by JackTerrance
0 votes
    To open the table, on the icon that has the required table name in Tables Pane of Database Window (A) Drag ... click (D) Triple Click Select the correct answer from above options...
asked Dec 24, 2021 in Education by JackTerrance
0 votes
    *Updated with more relevant code. *Updated again: removing chart groupings results in this error: "Unable to ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 1, 2022 in Education by JackTerrance
0 votes
    Can ASP.NET Core work with the .NET framework?...
asked Feb 16, 2023 in Technology by JackTerrance
0 votes
    When I select value in select2 multiple selection, the default 0 value is still there in the list. Any ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 17, 2022 in Education by JackTerrance
0 votes
    Which of the following value is not provided by AI? A. Quick decision making B. Process lots of data C. Increases time D. None of the options...
asked Nov 1, 2022 in Education by JackTerrance
0 votes
    Which of the following is not provided by BigDecimal? (a) scale manipulation (b) + operator (c) ... programming questions and answers pdf, java interview questions for beginners...
asked Oct 28, 2021 in Education by JackTerrance
0 votes
    A criterion for waiving informed consent is that, when appropriate, subjects are provided additional pertinent ... subjects with information about missing elements of consent:...
asked Mar 1, 2021 in Education by Editorial Staff
0 votes
    I have a large django form. It has a lot of data that depends on a field being selected. Eg: Do ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 2, 2022 in Education by JackTerrance
0 votes
     On the Origin of Species, by Means of Natural Selection' was written by (a) Hugo de Vries ... Science,Science proposed by,electromagnetic theory engineering physics,Science nptel...
asked Nov 8, 2021 in Education by JackTerrance
0 votes
    If access paths are available on all the conditions of a disjunctive selection, each index is scanned ... Operation in division Query Processing Techniques of Database Management...
asked Oct 10, 2021 in Education by JackTerrance
...