<div class="container-fluid">
<div class="form-group">
<label for="theComboString">Strings:</label>
<div id="theComboString"></div>
</div>
<p>
현재 값은 : <b id="theComboStringCurrent"></b>입니다.
</p>
<hr />
<div class="form-group">
<label for="theComboObject">Objects:</label>
<div id="theComboObject"></div>
</div>
<p>
현재 값은 : <b id="theComboObjectCurrent"></b> 입니다.
</p>
</div>
xxxxxxxxxx
@font-face {
font-family: 'S-CoreDream-3Light';
src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_six@1.2/S-CoreDream-3Light.woff') format('woff');
font-weight: normal;
font-style: normal;
}
body {
margin: 20px;
font-family: 'S-CoreDream-3Light';
}
.container-fluid{
background-color:#ededed;
padding:10px;
border-radius:10px;
}
xxxxxxxxxx
document.readyState === 'complete' ? init() : window.onload = init;
//
function init() {
// 국가 선택 (string)
var theComboString = new wijmo.input.ComboBox('#theComboString', {
selectedIndexChanged: (sender) => {
setText('theComboStringCurrent', sender.text);
},
itemsSource: getCountries()
});
//
// 항목 선택 (object)
var theComboObject = new wijmo.input.ComboBox('#theComboObject', {
selectedIndexChanged: (sender) => {
var text = wijmo.format('{country} (sales: {sales:c0}, expenses {expenses:c0})', sender.selectedValue);
setText('theComboObjectCurrent', text);
},
displayMemberPath: 'country',
itemsSource: getData()
});
//
// 페이지에 있는 요소에 텍스트 보여주기
function setText(id, value) {
document.getElementById(id).textContent = value;
}
}
//
function getCountries() {
return ['China', 'Germany', 'Greece', 'Italy', 'Japan', 'Portugal', 'Russia', 'Spain', 'UK', 'US'];
}
//
function getData() {
//랜덤 데이터 생성
let countries = getCountries(), data = [];
//
for (let i = 0; i < countries.length; i++) {
data.push({
country: countries[i],
active: i % 5 != 0,
sales: Math.random() * 100000,
expenses: Math.random() * 50000
});
}
//
return data;
}