Movatterモバイル変換


[0]ホーム

URL:


PDF
Edit
Suggest a Feature

    Grouping in Vue Drop down list component

    16 Oct 20246 minutes to read

    The DropDownList supports wrapping nested elements into a group based on different categories. The category of each list item can be mapped through thegroupBy field in the data table. The group header is displayed both as inline and fixed headers. The fixed group header content is updated dynamically on scrolling the popup list with its category value.

    How to group and filter the DropDownList Items, you can check on this video:

    In the following sample, vegetables are grouped according on its category usinggroupBy field.

    <template><divid="app"><divid='container'style="margin:20px auto 0; width:250px;"><br><ejs-dropdownlistid='dropdownlist'popupHeight='200px'placeholder='Select a vegetable':fields='fields':dataSource='dataSource'></ejs-dropdownlist></div></div></template><scriptsetup>import{DropDownListComponentasEjsDropdownlist}from"@syncfusion/ej2-vue-dropdowns";constdataSource=[{Vegetable:'Cabbage',Category:'Leafy and Salad',Id:'item1'},{Vegetable:'Spinach',Category:'Leafy and Salad',Id:'item2'},{Vegetable:'Wheat grass',Category:'Leafy and Salad',Id:'item3'},{Vegetable:'Yarrow',Category:'Leafy and Salad',Id:'item4'},{Vegetable:'Pumpkins',Category:'Leafy and Salad',Id:'item5'},{Vegetable:'Chickpea',Category:'Beans',Id:'item6'},{Vegetable:'Green bean',Category:'Beans',Id:'item7'},{Vegetable:'Horse gram',Category:'Beans',Id:'item8'},{Vegetable:'Garlic',Category:'Bulb and Stem',Id:'item9'},{Vegetable:'Nopal',Category:'Bulb and Stem',Id:'item10'},{Vegetable:'Onion',Category:'Bulb and Stem',Id:'item11'}];constfields={groupBy:'Category',text:'Vegetable',value:'Id'}</script><style>@import"../node_modules/@syncfusion/ej2-base/styles/material.css";@import"../node_modules/@syncfusion/ej2-inputs/styles/material.css";@import"../node_modules/@syncfusion/ej2-vue-dropdowns/styles/material.css";</style>
    <template><divid="app"><divid='container'style="margin:20px auto 0; width:250px;"><br><ejs-dropdownlistid='dropdownlist'popupHeight='200px'placeholder='Select a vegetable':fields='fields':dataSource='dataSource'></ejs-dropdownlist></div></div></template><script>import{DropDownListComponent}from"@syncfusion/ej2-vue-dropdowns";exportdefault{name:"App",components:{"ejs-dropdownlist":DropDownListComponent},data(){varvegetableData=[{Vegetable:'Cabbage',Category:'Leafy and Salad',Id:'item1'},{Vegetable:'Spinach',Category:'Leafy and Salad',Id:'item2'},{Vegetable:'Wheat grass',Category:'Leafy and Salad',Id:'item3'},{Vegetable:'Yarrow',Category:'Leafy and Salad',Id:'item4'},{Vegetable:'Pumpkins',Category:'Leafy and Salad',Id:'item5'},{Vegetable:'Chickpea',Category:'Beans',Id:'item6'},{Vegetable:'Green bean',Category:'Beans',Id:'item7'},{Vegetable:'Horse gram',Category:'Beans',Id:'item8'},{Vegetable:'Garlic',Category:'Bulb and Stem',Id:'item9'},{Vegetable:'Nopal',Category:'Bulb and Stem',Id:'item10'},{Vegetable:'Onion',Category:'Bulb and Stem',Id:'item11'}];return{dataSource:vegetableData,fields:{groupBy:'Category',text:'Vegetable',value:'Id'}}}}</script><style>@import"../node_modules/@syncfusion/ej2-base/styles/material.css";@import"../node_modules/@syncfusion/ej2-inputs/styles/material.css";@import"../node_modules/@syncfusion/ej2-vue-dropdowns/styles/material.css";</style>

    Customization

    The grouping header is also provided with customization option. This allows custom designing using thegroupTemplate property for both inline and fixed headers.

    See Also

    Help us improve this page

    Please provide additional information

    Please provide additional information

    Please provide additional information

    Please provide additional information

    Please provide additional information
    Please provide additional information
    ×

    [8]ページ先頭

    ©2009-2025 Movatter.jp