繁体   English   中英

如何在 AG-Grid 中禁用 SELECT OPTION

[英]How to disable a SELECT OPTION in AG-Grid

我正在尝试禁用 AG-Grid 和 React 中的下拉元素。 就像 W3Schools 的这个例子:

选项值=“沃尔沃”禁用>沃尔沃

这将是一个动态构建的下拉列表,我找不到使用 cellEditor 或 cellEditorParams 执行此操作的能力。 我找不到任何证据表明在 AG-Grid 中可以禁用下拉选项。

您可以通过为该字段使用自定义单元格渲染器来实现此目的,即

 {
     field: 'yourField',
     cellRenderer: 'selectboxRenderer',

    // Here **disable** is the prop that will get passed to your selectBoxRenderer
    // You can put your condition when based on which you want to disable
    // You will also have to receive that **prop** in your component
      cellRendererParams: {
          disable: ({ data }) => { 
              // Your condition here
          },
      }
 }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM