How to show a default value "All" with a down arrow at end for MultiSelectDropDown ?

How to show a default value "All" with a down arrow at end for MultiSelectDropDown ? 

How to have a border for MultiSelectDropDown when on focus ? 





1 Reply 1 reply marked as answer

SP Sureshkumar P Syncfusion Team April 6, 2022 01:40 PM UTC

Hi Aravind,


Based on your shared information, we suggest you include the initial value with your requested text and preselect the default value by using value property.


Find the code example here:

export class Default extends SampleBase {

  listObj;

  // define the JSON of data

  sportsData = [

    { Id: 'Game0', Game: 'All' },

    { Id: 'Game1', Game: 'American Football' },

    { Id: 'Game2', Game: 'Badminton' },

    { Id: 'Game3', Game: 'Basketball' },

    { Id: 'Game4', Game: 'Cricket' },

    { Id: 'Game5', Game: 'Football' },

    { Id: 'Game6', Game: 'Golf' },

    { Id: 'Game7', Game: 'Hockey' },

    { Id: 'Game8', Game: 'Rugby' },

    { Id: 'Game9', Game: 'Snooker' },

    { Id: 'Game10', Game: 'Tennis' },

  ];

  // maps the appropriate column to fields property

  fields = { text: 'Game', value: 'Id' };

  // set the value to select an item based on mapped value at initial rendering

  value = 'Game0';

  render() {

    return (

      <div id="dropdowndefault" className="control-pane">

        <div className="control-section">

          <div className="col-lg-8">

            <div className="content-wrapper">

              <div id="default">

                <DropDownListComponent

                  id="games"

                  dataSource={this.sportsData}

                  ref={(dropdownlist) => {

                    this.listObj = dropdownlist;

                  }}

                  fields={this.fields}

                  placeholder="Select a game"

                  value={this.value}

                  popupHeight="220px"

                />

              </div>

            </div>

          </div>

        </div>

      </div>

    );

  }

}

 

render(<Default />, document.getElementById('sample'));

 

 


Please confirm whether the above suggestion meets your requirement. If not, please share your exact use case. These details will help us to provide exact solution as earlier as possible.


Also, find the style changes when focus the component:

.e-input-group.e-input-focus:not(.e-success):not(.e-warning):not(.e-error),

.e-input-group.e-control-wrapper.e-input-focus:not(.e-success):not(.e-warning):not(.e-error) {

  border-colorred;

  border-radius4px;

  box-shadow0 0 0 4px red;

}

 


To know more about CSS customization to refer the documentation: https://ej2.syncfusion.com/react/documentation/multi-select/style/


Find the sample here: https://stackblitz.com/edit/react-vy36jz?file=index.css


Regards,

Sureshkumar P



Marked as answer
Loader.
Up arrow icon