React是一个用于构建用户界面的JavaScript库。它使用声明范式,旨在既高效又灵活。
这是我的代码,如何使用我的componentDidmount()将数据= {data}的muidataTAttion推出。我已经可以从用户集合中获取数据,但是,我不知道A ...
MUI-DATATABLES,儿童组件检测父零件状态的变化 我是从React开始的,这个问题使我的睡眠消失了。 据我了解,状态(this.state)仅在创建的组件中才能访问,但是在我的项目中,...
class PendingOrders extends Component { constructor() { super(); this.state = { orders: [] }; } columns = [ "Order ID", { name: "Confirm", options: { filter: true, sort: false, empty: true, customBodyRender: ( value, tableMeta, ) => { return ( <FormControlLabel value={value} control={ <Button value={value} color="secondary" variant="primary"> confirm </Button> } onClick={(e) => { try { firestore.collection("orders").doc(tableMeta.rowData[0]).set( { orderStatus: "Confirmed", }, { merge: true } ); } catch (err) { console.log(err); } }} /> ); }, }, }, componentDidMount() { try { firestore .collection("orders") .where("orderStatus", "==", "Pending") .get() .then((snapshot) => { const orders = []; snapshot.docs.map((doc) => { const items = []; orders.push({ const items = []; doc.data().items.forEach((item) => { items.push(`${item.productName}(${item.qty}),`); }); const data = doc.data(); orders.push({ "Order ID": doc.id, "Items":items, }); }); this.setState({ orders: orders }); // console.log(this.state.orders); }); } catch (err) { console.log(err); } } render() { return ( <div> <MUIDataTable title={"Pending Orders"} columns={this.columns} data={this.state.orders} options={this.options} /> </div> ); } }
Mui-dataTables:如何在一列中显示这些项目数组?
这是我从Firestore获取数据的代码。 类悬浮台实扩展了组件{ constructor(){ 极好的(); this.state = {orders:[]}; } 列= [ “订购我...
检查是否选择了mui-dataTables Onrowselect?
如何知道是否在Onrowselect方法中选择了该行? 可从“ Mui-databers”导入穆德塔特; ... const [total,settotal] = usestate(0); ... const handlerowselect =(
将此错误“ FindDomNode在严格模式中被弃用”。部署我的React项目时失败吗?
即使我要使用此错误,我将部署我的React项目时“ FindDomNode在严格模式中被弃用”。部署期间会失败吗?此错误是由于材料 - UI的持久性博士...
我有一个表可以呈现两个按钮,即删除和编辑行。 在这两个方面,我都需要访问行ID。 我尝试使用customBodyRender,但它不起作用,我只有DatainDex和行...
我只能在单击该行时如何扩展该行? 我有这张材料表。每次我单击按钮扩展行1时,它也会展开第二行。如何在只有特定行扩展的地方解决此问题?
<Table stickyHeader aria-label="sticky table"> <TableHead> <TableRow hover> <TableCell>Title</TableCell> <TableCell>Created Date</TableCell> </TableRow> </TableHead> <TableBody> {data && data((index) => ( <TableRow hover> <TableCell> <IconButton aria-label="expand row" size="small" onClick={() => setOpen(!open)} > {open ? ( <KeyboardArrowUpIcon /> ) : ( <KeyboardArrowDownIcon /> )} </IconButton> </TableCell> <TableCell component="th" scope="row"> {index.title} </TableCell> <TableCell component="th" scope="row"> {new Date( index.createdDate.seconds * 1000 ).toDateString()} </TableCell> <TableCell colSpan={6}> <Collapse in={open} timeout="auto" unmountOnExit> {index.text} </Collapse> </TableCell> </TableRow> ))} </TableBody> </Table> 在组件中wrapTableRow const Row = ({item}) => { const [open, setOpen] = useState(false); return <TableRow>...</TableRow> } <TableBody> {data.map((item, index) => ( <Row key={index} item={item} /> ))} </TableBody>
Mui-dataTables:如何从可扩展行内的firestore传递文本数据,并在设置处传递文档ID?
在Firestore中,我有此字段标题,创建日期和文本。我如何在MUI-DataTable中显示字段标题并创建了DEDATE。然后将在扩展的行中显示文本。怎么...
输入图像描述在这里 如上图中所示,我想在可与标头的穆德塔上显示它 我尝试了以下代码,但是我没有得到适当的表格,它显示出显示的标题...
获取行数据,但是当我将索引从
我有一个基本上是对象的列,我显示要显示的值,但是对于该列不起作用。 附上一个例子,这样我就可以更好地解释自己。 对于审查...
const options = { filterType: 'checkbox', customToolbarSelect: selectedRows => ( <MyCustomToolbarSelect selectedRows={selectedRows} onRowsDelete={deleteSelected} /> ), }