gregnb / gregnb/mui-datatables

Data overlapping in portrait orientation on mobile devices

Open
#1,142 9 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.7k
Forks
906
PR merge metrics
No merged PRs in 30d

Description

Hi, I'm not sure if this is an issue or that I am doing something wrong.
I'm using the option `responsive: "stacked"`, in landscape orientation the data appears fine,
but on an iPhone 8 for example in portrait mode the data overlaps.

## Expected Behavior
Screenshot 2020-01-08 at 12 07 09

## Current Behavior
Screenshot 2020-01-08 at 12 07 43

## Steps to Reproduce (for bugs)
I noticed that using Chrome dev tools and reducing the width of the screen to below
525 pixel the items overlap as can be seen in the current behaviour screenshot.

Another person who created this [code sandbox](https://codesandbox.io/s/k22kzo8zzv) for their own project they don't appear to have that problem at all, possibly is it because their columns and rows contain little data.

## Your Environment
This is my implementation of the `mui-datatables`

```
`import React from "react";
import MUIDataTable from "mui-datatables";
import moment from "moment";
// noinspection ES6CheckImport
import { useHistory } from "react-router-dom";

function RecordTable({ forms }) {
let history = useHistory();
const customFields = JSON.parse(localStorage.getItem("customFields"));
let customFieldName = "";
if (Array.isArray(customFields) && customFields.length) {
customFieldName = customFields[0].customFieldName;
} else {
customFieldName = "Custom Field";
}
//const customFieldName = customFields?.[0]?.customFieldName || "Custom Field";

const columns = [
{
name: "childNames",
label: "Child Name",
options: {
filter: true,
customBodyRender: value => {
return

{value[0]}
;
}
}
},
{
name: "timeIn",
label: "Time In",
options: {
sortDirection: "asc"
}
},
{
name: "timeOut",
label: "Time Out"
},
{
name: "parentName",
label: "Parent Name",
options: {
filter: true
}
},
{
name: "customFields",
label: customFieldName,
options: {
customBodyRender: value => {
if (
Array.isArray(value) &&
value.length &&
value[0].customFieldName === customFieldName
)
return
{value[0].customFieldValue}
;
}
}
},
{
name: "docId",
options: {
display: "excluded"
}
},
{
name: "totalNumberOfOccupants",
options: {
display: "excluded"
}
},
{
name: "rulesOfPlay",
options: {
display: "excluded"
}
},
{
name: "parentsWaiver",
options: {
display: "excluded"
}
},
{
name: "parentSignature",
options: {
display: "excluded"
}
},
{
name: "notes",
options: {
display: "excluded"
}
}
];

const openViewDisclaimerPage = row => {
history.push("/viewform", { ...row });
};

const options = {
filter: false,
viewColumns: false,
print: false,
responsive: "stacked",
selectableRows: "none",
searchOpen: true,
downloadOptions: {
filename: "..." + new moment().format("LL") + ".csv"
},
searchPlaceholder: "Search records...",
onRowClick: row => {
console.log("row clicked ", row);
//columnNumber contains the docId
//change the columnNumber if docId is moved to another column
const columnNumber = 5;
let selectedRow = forms.find((form, index) => {
return form.docId === row[columnNumber];
});
console.log("selectedRow:", selectedRow);
openViewDisclaimerPage(selectedRow);
}
};

return (

);
}
export default RecordTable;
`
```

| Tech | Version |
|--------------|---------|
| Material-UI | 2.8.3 |
| MUI-datatables | 2.13.3 |
| React | 16.12.0 |
| browser | Chrome 79.0.3945.88 |
| etc | |

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the `responsive: "stacked"` table at widths below 525px using the issue's columns and data shape, then compare portrait and landscape behavior. Trace the stacked responsive entry point in the mui-datatables source and verify the result against the provided screenshots; done means long cell contents no longer overlap on narrow screens.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.