Web Components コンボボックスは、ユーザーが提供されたリストでさまざまな定義済みオプションを簡単に選択、フィルタリング、およびグループ化できるようにする軽量のエディターです。このコンポーネントは、Web Components コンボボックス キーボード ナビゲーションのオプション、項目、ヘッダー、およびフッターの表示方法をカスタマイズするためのテンプレートもサポートしています。
Ignite UI for Web Components コンボボックス コンポーネントは、ユーザーが選択できるオプションのリストを提供します。仮想化された項目のリストにすべてのオプションが表示されます。つまり、コンボボックスは、1 つ以上のオプションを選択できる数千のレコードを同時に表示できます。さらに、このコンポーネントには、大文字と小文字を区別するフィルタリング、グループ化、複雑なデータ バインディングなどの機能があります。
<!DOCTYPE html><html><head><title>Combo Overview</title><metacharset="UTF-8" /><linkrel="stylesheet"href="https://static.infragistics.com/xplatform/css/samples/shared.v8.css"type="text/css" /><linkhref="https://static.infragistics.com/xplatform/css/samples/custom-legend.css"rel="stylesheet"type="text/css" /></head><body><divid="root"><divclass="container sample center"><igc-comboid='combo'value-key='id'display-key='name'value='["BG01"]'
></igc-combo></div></div><!-- This script is needed only for parcel and it will be excluded for webpack -->
<% if (false) { %><scriptsrc="src/index.ts"></script><% } %>
</body></html>html
/* shared styles are loaded from: *//* https://static.infragistics.com/xplatform/css/samples */css
このサンプルが気に入りましたか? 完全な Ignite UI for Web Componentsツールキットにアクセスして、すばやく独自のアプリの作成を開始します。無料でダウンロードできます。
Web Components コンボボックス コンポーネントを使用した作業の開始
まず、次のコマンドを実行して Ignite UI for Web Components をインストールする必要があります:
const combo = document.getElementById('basic-combo') as IgcComboComponent<City>;
// Given the overview example from above this will return ['BG01']console.log(combo.value);
// Change the selected items to New York and London
combo.value = ['NY01', 'UK01'];
ts
// Select/deselect items by their IDs as valueKey is set to 'id'
combo.select(['BG01', 'BG02', 'BG03', 'BG04']);
combo.deselect(['BG01', 'BG02', 'BG03', 'BG04']);
ts
すべての項目を選択 / 選択解除:
// Select/deselect all items
combo.select();
combo.deselect();
ts
// Select/deselect values by object references when no valueKey is provided
combo.select([cities[1], cities[5]]);
combo.deselect([cities[1], cities[5]]);
ts
<!DOCTYPE html><html><head><title>Combo Selection API</title><metacharset="UTF-8" /><linkrel="stylesheet"href="https://static.infragistics.com/xplatform/css/samples/shared.v8.css"type="text/css" /><linkhref="https://static.infragistics.com/xplatform/css/samples/custom-legend.css"rel="stylesheet"type="text/css" /></head><body><divid="root"><divclass="container sample center"><igc-comboid="combo"value-key="id"display-key="name"label="Cities"placeholder="Pick a city"placeholder-search="Search for a city"
></igc-combo><divclass="button-container"><igc-buttonid="select">Select UK Cities</igc-button><igc-buttonid="deselect">Deselect UK Favorites</igc-button><igc-buttonid="selectAll">Select All</igc-button><igc-buttonid="deselectAll">Deselect All</igc-button></div></div></div><!-- This script is needed only for parcel and it will be excluded for webpack -->
<% if (false) { %><scriptsrc="src/index.ts"></script><% } %>
</body></html>html
<!DOCTYPE html><html><head><title>Combo Styling</title><metacharset="UTF-8" /><linkrel="stylesheet"href="https://static.infragistics.com/xplatform/css/samples/shared.v8.css"type="text/css" /><linkhref="https://static.infragistics.com/xplatform/css/samples/custom-legend.css"rel="stylesheet"type="text/css" /></head><body><divid="root"><divclass="container sample center"><igc-comboid="combo"value-key="id"display-key="name"group-key="country"label="Destinations"case-sensitive-icon
><spanslot="helper-text">Choose the desired place</span><igc-iconslot="prefix"name="place"collection="material"></igc-icon></igc-combo></div></div><!-- This script is needed only for parcel and it will be excluded for webpack -->
<% if (false) { %><scriptsrc="src/index.ts"></script><% } %>
</body></html>html