簡體   English   中英

添加一個按鈕來反應材料表工具欄

[英]Add a button to react material-table toolbar

我想在材料表工具欄上添加一個按鈕。 它不做任何與表格相關的事情。 它只是打開一個帶有一些信息的模式

我想在“添加項目”按鈕的左側添加一個名為“引用”的按鈕。

在此處輸入圖片說明

沙盒代碼: https : //codesandbox.io/embed/charming-yalow-4pnk4? fontsize =14& hidenavigation =1& theme =dark

根據文檔,您似乎需要覆蓋表格的 Toolbar 組件,並且您應該能夠在列標題上方添加任何您想要的內容:

https://material-table.com/#/docs/features/component-overriding

https://i.stack.imgur.com/J0mqf.png

正如威爾·埃弗斯提到,有可能添加任何必要Toolbar的的MaterialTable使用組件Toolbar道具:

          Toolbar: (props) => (
            <div
              style={{
                display: "flex",
                justifyContent: "flex-end",
                alignItems: "center"
              }}
            >
              <Button
                style={{ height: "fit-content" }}
                color="primary"
                variant="contained"
              >
                Quotations
              </Button>
              <div style={{ width: "13rem" }}>
                <MTableToolbar {...props} />
              </div>
            </div>
          ),

工作演示

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM