Topic: disable mdbnavlink or mdbdropdownitem

endysar@gmail.com free asked 3 years ago


How to disable a MdbNavLink or MDBDropdownitem because some user doest not have the right to use the menu and I will like to disable the click if the user login ?

For now i hide the menu like the code below but if i can just disable the click it will be a lot easier.

<MDBNavbar color="indigo" dark expand="md">
              <MDBNavbarBrand>
                <strong className="white-text">SiapMenang</strong>
              </MDBNavbarBrand>
              <MDBNavbarToggler  />
              <MDBCollapse id="navbarCollapse3" isOpen={true} navbar>
                <MDBNavbarNav left>
                  <MDBNavItem>
                    <MDBDropdown>
                      <MDBDropdownToggle nav caret>
                        <div className="d-none d-md-inline">Master</div>
                      </MDBDropdownToggle>
                      <MDBDropdownMenu className="dropdown-default" right>
                        <MDBDropdownItem>
                          <MDBNavLink className="black-text" to="/Landing/Operator">Operator</MDBNavLink>
                        </MDBDropdownItem>
                      </MDBDropdownMenu>
                    </MDBDropdown>
                  </MDBNavItem>
                  {
                    this.props.CustMenu === '1' ? (
                      <MDBNavItem>
                        <MDBNavLink to="/Landing/Costomer">Customer</MDBNavLink>
                      </MDBNavItem>
                    ) : (
                      null
                    )
                  }
                  {
                    this.props.InputMenu === '1' ? (
                      <MDBNavItem>
                        <MDBNavLink to="/Landing/Input">Input</MDBNavLink>
                      </MDBNavItem>
                    ) : (
                      null
                    )
                  }
                  {
                    this.props.HasilMenu === '1' ? (
                      <MDBNavItem>
                        <MDBNavLink to="/Landing/Result">Hasil</MDBNavLink>
                      </MDBNavItem>
                    ) : (
                      null
                    )
                  }
                  {
                    this.props.LapMenu === '1' ? (
                      <MDBNavItem>
                        <MDBNavLink to="/Landing/Laporan">Laporan</MDBNavLink>
                      </MDBNavItem>
                    ) : (
                      null
                    )
                  }
                </MDBNavbarNav>
              </MDBCollapse>
            </MDBNavbar>

Konrad Stępień staff commented 3 years ago

Hi @endysar@gmail.com,

Did you use disabled property for components?

Best regards, Konrad.



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Opened

Specification of the issue

  • User: Free
  • Premium support: No
  • Technology: MDB React
  • MDB Version: 4.21.1
  • Device: Macintosh
  • Browser: Safari
  • OS: MoJave
  • Provided sample code: No
  • Provided link: No