- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
是否可以使 Material UI Datagrid Header 具有粘性?似乎这可以通过 Material UI Tables 实现。我无法找到使用数据网格执行此操作的选项。
最佳答案
正如评论中提到的,这是默认行为。
然而,很少有错误可以阻止这种默认功能。就我而言,这是我错过的属性(property):autoHeight={true}
,应该是false
或者只是删除它。
这是一个广泛的代码示例,下面是 SandBox 的链接:
import { DataGrid, GridToolbar } from "@mui/x-data-grid";
import React from "react";
export default function AdvanceTable() {
const [pageSize, setPageSize] = React.useState(5);
const [editRowsModel, setEditRowsModel] = React.useState({});
const handleEditRowsModelChange = React.useCallback((model) => {
// Set current edited cell
setEditRowsModel(model);
});
return (
<div>
<div style={{ width: "100%", height: "80vh" }}>
<DataGrid
components={{
Toolbar: GridToolbar
}}
rows={rows}
columns={columns}
disableSelectionOnClick
checkboxSelection
onEditRowsModelChange={handleEditRowsModelChange}
pagination
pageSize={pageSize}
onPageSizeChange={(newPageSize) => setPageSize(newPageSize)}
rowsPerPageOptions={[5, 10, 15]}
/>
</div>
<div style={{ marginBottom: 8 }}>
<code>Edited table values: {JSON.stringify(editRowsModel)}</code>
</div>
</div>
);
// mock data:
const columns = [
{ field: "id", headerName: "ID", width: 70 },
{
field: "firstName",
headerName: "First name",
editable: true,
width: 180
},
{ field: "lastName", headerName: "Last name", editable: true, width: 180 },
{
field: "age",
headerName: "Age",
type: "number",
editable: true,
width: 150
}
];
const rows = [
{ id: 1, lastName: "Snow", firstName: "Jon", age: 35 },
{ id: 2, lastName: "Lannister", firstName: "Cersei", age: 42 },
{ id: 3, lastName: "Lannister", firstName: "Jaime", age: 45 },
{ id: 4, lastName: "Stark", firstName: "Arya", age: 16 },
{ id: 5, lastName: "Targaryen", firstName: "Daenerys", age: null },
{ id: 6, lastName: "Melisandre", firstName: null, age: 150 },
{ id: 7, lastName: "Clifford", firstName: "Ferrara", age: 44 },
{ id: 8, lastName: "Frances", firstName: "Rossini", age: 36 },
{ id: 9, lastName: "Roxie", firstName: "Harvey", age: 65 },
{ id: 41, lastName: "Stark", firstName: "Arya", age: 16 },
{ id: 51, lastName: "Targaryen", firstName: "Daenerys", age: null },
{ id: 61, lastName: "Melisandre", firstName: null, age: 150 },
{ id: 71, lastName: "Clifford", firstName: "Ferrara", age: 44 },
{ id: 81, lastName: "Frances", firstName: "Rossini", age: 36 },
{ id: 91, lastName: "Roxie", firstName: "Harvey", age: 65 }
];
}
SandBox example
关于datagrid - Material UI 数据网格粘性标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66435092/
我正在使用 Avalonia.Controls.DataGrid。默认情况下,当网格获得焦点并按下 Enter 时,它会自动处理事件并将选择移动到下一项。我怎样才能防止这种默认行为?我想要一个自定义的
根据我所见,Dojo DataGrid 中的格式化程序函数被赋予以下参数:单元格值、单元格行号和单元格对象本身。鉴于这些参数,您能否建议如何获取此单元格所引用的数据存储项?或者,如果您能提出替代方法,
我是DoJo开发的新手,所以这可能很基础。 我创建了一个EnhancedDatagrid,它可以很好地显示数据。 数据来自另一个页面中的JSON存储。 我有一个按钮,该按钮导致在数据存储中创建一个新条
我正在尝试在 WPF DataGrid 的 RowDetailsTemplate 中创建一个 DataGrid。 我有一系列工作。每个工作都可以分配一个或多个员工: public class Job
我有一个数据网格组件: [... some controlls ...]
我已经以编程方式创建了一个dojox.grid.datagrid,并且我需要对列进行自定义排序。为此,我尝试使用 ItemFileWriteStore.comparatorMap['field'] =
我试图在 UWP RadDataGrid 控件的 Telerik UI 中隐藏 GroupPanel。 radgrid.ShowGroupPanel 不起作用。 最佳答案 UserGroupMode=
我收到“在使用 ItemsSource 时操作无效。改为使用 ItemsControl.ItemsSource 访问和修改元素”错误,我不确定原因。 我正在尝试将数据网格嵌套在数据网格中。如果我只使用
我的 WPF forme Etudiant 中有一个 DataGrid 当单击 Etudiant 中名为 Epreuve 的行时,我需要显示其他数据网格,并且当在 Epreuve 中选择一行并且我需要
我有一个 DataGrid“嵌套”在另一个 DataGrid 的 RowDetailsTemplate 中。只要我的鼠标悬停在父 DataGrid 上行的主要部分上,滚动就可以正常工作,但是当鼠标悬停
我花了几个小时看这个没有结果。 我只是想要一个DataGrid X 列保持与 Grid 的相对宽度本身。 因此,例如: 第 1 栏:10% 第 2 栏:10% 第 3 栏:10% 我设置了一个附加到
我有 3 个共享相同数据类型的数据网格。我想配置一次列绑定(bind)并让 3 个数据网格共享资源。 例如
我之前关于检测 VM 中的属性更改的帖子不够深入,所以我发布了这个 我有一个工作网格。每个工作可以有一个或多个员工。 DataGrid 的 RowDetailsTemplate 包含另一个用于显示员工
我将尝试找出将 ComboBox 嵌入到 Flex (3.4) DataGrid 中的“正确”方法。根据权利(例如,根据本页 http://blog.flexmonkeypatches.com/200
我有一个对象集合,我们称之为 People,每个对象都由名称、ID 和时间字符串组成。这些人物必须显示在类似于固定行数和 9 列的网格上。这个想法是将人员作为行添加到第 1、2 和 3 列中的网格左侧
默认行为是使用 CTRL+Click 取消选择 Datagrid 中的项目 我希望能够通过鼠标单击(左键或右键)网格中的空白区域并让它取消选择任何选定的项目。 我已经用谷歌搜索死了,发现了一些非常复杂
我正在使用 DataGrid来自 WPF Toolkit我需要能够将注意力集中在网格的底部(即最后一行)。我现在遇到的问题是,随着行的添加,DataGrid 的滚动条不会随着新行的添加而滚动。实现此目
我正在使用 DataGrid 来管理服务配置。我想使用自动生成的行复选框来管理多个删除操作,但想使用 onRowClick 事件将行数据提供给模态对话框表单进行编辑。我的 onRowClick 处理程
我有一个包含项目的 DataGrid。当您右键单击其中一行时,会显示一个 Dojo 上下文菜单,其中包含删除该行的选项。如果您尝试右键单击 DataGrid 的空白区域,则不会显示上下文菜单……但是,
我想在另一个 Datagrid 的 RowDetailsTempalte 中使用一个 DataGrid。此内部 Datagrid 应将其列绑定(bind)到外部 Datagrid 中当前对象的属性。例
我是一名优秀的程序员,十分优秀!