问题标签 [mui-datatable]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
101 浏览

angular - NgxMuiDatatables Can not compile using --aot

Hey I was trying to integrate this library in my Angular project, but got the following error:

Unexpected value 'NgxMuiDatatablesModule in /Users/.../node_modules/ngx-mui-datatables/ngx-mui-datatables.d.ts' imported by the module 'AppModule in /Users/.../src/app/app.module.ts'. Please add a @NgModule annotation.

The module was originally imported in app.module.ts, and the package was installed via npm.

I'm using Angular 8.2.1 And the library which I imported is: 0.0.10 as the lateset version I believe.

I have tried many different ways suggested by others on Github, but it was not related to this specific package, although the compilation error is similar: Unexpected value... Please add a @NgModule annotation.

Here is my app.module.ts:

Again, the module was originally imported here, but I was exploring different solutions, so you'll see a duplicate import in my flight-management.module.ts, but it shouldn't be the problem, since I have tested by removing the import from app.module.

The datatable module is used in several components, so I'm posting one of them for information.

flight-management.component.html:

flight-management.module.ts:

My app works fine in dev environment, using default --jit compile mode, but fails using --aot specifically. Also, it fails to deploy to prod environment, which is by default using --aot.

I know there's a workaround to disable aot and compileOptimizer when ng build prod, but I am hoping there's an actual solution to this problem. Since disabling ahead-of-time and optimizer greatly increases the build time.

Any help is appreciated!

0 投票
1 回答
626 浏览

reactjs - 限制全选到当前页面 MUIDatatables

我在我的应用程序中使用 mui-datatable ( https://github.com/gregnb/mui-datatables )。标题中的“全选”复选框检查表中的所有记录。我如何将其限制为当前页面?

谢谢

0 投票
2 回答
6409 浏览

reactjs - 如何使用 MUI-Data-Tables 呈现列内的项目数组?

我有要使用 MUI-Data-Table 组件在数据表中显示的文本列表,但我面临的问题是在列中显示的不是单个项目而是项目列表。我有一个名为系统的项目。它包含一系列国家/地区,因此我只想在一个列中显示该数组,但我不知道该怎么做。

这是我的 json :

这就是我自定义专栏的方式,因为我需要遵循某种模式:

如需更多解释,选项名称必须与 json 中的名称相同,并且它只呈现一个对象,但 theme.systeme.system_country 是我想要显示的一组国家/地区的 ID,但它不会让我不知道如何自定义我的列来做这样的事情,或者我可以做些什么来实现它

0 投票
1 回答
2062 浏览

reactjs - 状态正在改变,但数据表未显示新数据

我正在使用material-ui库并制作数据表。对于数据表,我正在使用这个库mui-datatables。我需要调用 API 来检索数据并在表格中显示。我在控制台中检查了数据即将到来但未显示在数据表中。

下面是我的代码:

并显示如下数据:

如果有人帮助我,那就太好了。

0 投票
2 回答
6607 浏览

javascript - 突出显示 MUI 数据表中的行

我使用 React.js 和MUI-Datatables创建了一个简单的表:

如何将自定义 CSS 类添加到表内的单行。假设我希望 John Walsh 的第二行具有绿色背景色。

更新:

使用customRowRender允许设置特定行的样式,但我仍然对解决方案不是 100% 满意,因为可选行等某些功能不再开箱即用:

0 投票
1 回答
77 浏览

reactjs - 如何在不获取整个材料/核心的情况下仅使用 MUI-Datatable?

我使用 antdesign 作为 react 项目的整体库,但我想使用 MUI-Datatable,因为它有更好的表格和功能。

如果没有其他方法可以做到这一点,在一个反应​​项目中使用 2 个完整的库是否会产生影响?

0 投票
1 回答
929 浏览

reactjs - 如何在 mui-datatables 中默认取消选择 selectableRows 中的复选框(当没有数据行时)?

如果有数据,它工作正常。但是,虽然没有数据,但默认情况下会被选中。

这是我的代码,用于选项。

如果我运行上面的代码,我会得到空表。 输出

有人可以帮我解决如何删除它吗?

先感谢您。

0 投票
0 回答
1346 浏览

reactjs - 反应 mui-datatables selectableRows

我从 api(api1) 获取数据并发送到表并渲染它,然后我从另一个 api(api2) 获取一些数据所以......

如果它从 api2 接收数据(如果它在表中但不知道如何),我想默认被选中?

In the following with below code : I have both the selected(from api2) and the new ones selected but problem this function runs when one of the rows is selected

0 投票
2 回答
3363 浏览

javascript - 如何使用对象键在 mui 数据表中设置列名

我正在尝试使用对象键来设置 MUI 数据表中列的名称。我正在尝试使用 children.childName 的第一个元素设置其中一个列名,以便在该列中显示子名列表,但仅显示第一个子项。

在我尝试这个的当前方式中,我没有收到任何错误,并且它在表格的 childName 列中没有显示任何内容。

如何访问数组内的对象?

显示表的屏幕截图

这是我的数据:

MuiTable.js

通过执行 console.log 我可以看到它正在打印值而不是对象键名

列的控制台日志

我真的很感激任何帮助,谢谢。

0 投票
2 回答
5852 浏览

mui-datatable - mui 数据表列宽选项不可用

我正在尝试为每一列设置不同的列宽。但是在 mui 数据表列选项中没有设置列宽的选项。我也尝试覆盖 css 属性,但这也不起作用。是否有任何其他选项来设置列宽。MUIDataTableBodyCell:{根:{高度:'30px',宽度:'200px'}},