Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SelectField can't open. #4237

Closed
blankzust opened this issue May 11, 2016 · 15 comments
Closed

SelectField can't open. #4237

blankzust opened this issue May 11, 2016 · 15 comments
Labels
support: question Community support but can be turned into an improvement v0.x

Comments

@blankzust
Copy link

blankzust commented May 11, 2016

Problem description

I can't open the SelectField,that is it is not useful to click SelectField.But My code is just referred to http://www.material-ui.com/#/components/select-field
Could you give me some suggestions?

Steps to reproduce

1.I write a div that contains a SelectField

<div>
         <SelectField
                            floatingLabelText="sex"
                            value={this.props.pageData.newUser == undefined?"1":this.props.pageData.newUser.sex}
                            onChange={(event, index, value) => {
                                let tempPageData = this.props.pageData;
                                tempPageData.newUser.sex = value;
                                this.props.changePageData(tempPageData);
                            }}
                        >
                            <MenuItem value="1" primaryText="man"/>
                            <MenuItem value="2" primaryText="woman"/>
                        </SelectField>
 </div>

The default value of SelectField is "1"
2.The Page shows as follows:
image

Versions

  • Material-UI: ^0.15.0
  • React: ^15.0.1
  • Browser: google cherome
@blankzust
Copy link
Author

The console shows no error.

@blankzust
Copy link
Author

@mbrookes I use npm install material-ui to install material-ui.I have already use TextField And Manu,so it seems that I have already install material-ui correctly

@blankzust
Copy link
Author

image

@Autopilot9369
Copy link

how did you solve this issue? I have having the same problem

@jackmoore
Copy link

Had the same problem, resolved it by installing react-tap-event-plugin

@Autopilot9369
Copy link

Autopilot9369 commented May 24, 2016

it doesn't work for me. i tried everything.. on setting showImmediately = {true} the menu shows but on click on any option, nothing works. and without showImmediately, on clicking the select field, nothing works..

@blankzust blankzust reopened this May 24, 2016
@blankzust
Copy link
Author

blankzust commented May 24, 2016

import injectTapEventPlugin from "react-tap-event-plugin";
injectTapEventPlugin();

try it @subhamagr

@Autopilot9369
Copy link

Autopilot9369 commented May 24, 2016

import React, { Component } from 'react';
import { MenuItem , SelectField } from 'material-ui'
import injectTapEventPlugin from "react-tap-event-plugin";

injectTapEventPlugin();


class MySelectField extends Component {
    constructor (props) {
        super(props);
        this._handleChange = this._handleChange.bind(this);
        this.state = {
            value: 1
        }
    }

    _handleChange (event, target, value) {
        console.log(event, target, value);
        this.setState({ value })
    }

    render () {
       return (
           <SelectField value={this.state.value} onChange={this._handleChange}>
                    <MenuItem value={1} primaryText="Never" />
                    <MenuItem value={2} primaryText="Every Night" />
                    <MenuItem value={3} primaryText="Weeknights" />
                    <MenuItem value={4} primaryText="Weekends" />
                    <MenuItem value={5} primaryText="Weekly" />
          </SelectField>
       )
  }
}

Nothing works at all.

screenshot

@blankzust
Copy link
Author

blankzust commented May 24, 2016

Sorry, I don't know.I solved it by this this way.Maybe you can @mbrookes. @subhamagr But I know your misery because I have spent a lot of time on it.

@Autopilot9369
Copy link

yes i am stuck on it since 2 days! the click event doesn't fire at all. I don't know what to do. Not only this, the DropDown, PopOver and all nothing works!

@mbrookes mbrookes added the support: question Community support but can be turned into an improvement label May 24, 2016
@mbrookes
Copy link
Member

Closing as this is not a Material-UI issue.

@subhamagr Please use gitter / SO if you're still having problems after installing react-tap-event-plugin and adding it to your top level module.

@timscott
Copy link

The solution for me was to upgrade React. I upgraded to 15.1.0 but I suspect ^15.0.0 will do the trick.

@safouman
Copy link

@subhamagr did u fix it ?

@Autopilot9369
Copy link

Autopilot9369 commented Jun 26, 2016

@safouman yes, I solved it by upgrading react version to 15.1.0. If that doesn't work out for you, check the dependencies of material-ui and upgrade/install accordingly.

@Albosonic

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support: question Community support but can be turned into an improvement v0.x
Projects
None yet
Development

No branches or pull requests

8 participants