|
hideSelectedItem |
Hides the selected item from the list item. |
|
|
chipSelection
|
triggers when the chip selection. |
|
|
Tagging |
Fires before set the selected item as chip in the component. |
|
<code>
this.vegetables = [
{ text: 'Leafy and Salad', Category: 'Vegetables', Id: "1" },
{ text: 'Bulb and Stem', Category: 'Vegetables', Id: '2' },
{ text: 'Beans', Category: 'Vegetables', Id: '3' },
{ text: 'Cabbage', Category: 'Leafy and Salad', Id: 'item1' },
{ text: 'Chickpea', Category: 'Beans', Id: 'item2' },
{ text: 'Garlic', Category: 'Bulb and Stem', Id: 'item3' },
{ text: 'Green bean', Category: 'Beans', Id: 'item4' },
{ text: 'Horse gram', Category: 'Beans', Id: 'item5' },
{ text: 'Nopal', Category: 'Bulb and Stem', Id: 'item6' },
{ text: 'Onion', Category: 'Bulb and Stem', Id: 'item7' },
{ text: 'Pumpkins', Category: 'Leafy and Salad', Id: 'item8' },
{ text: 'Spinach', Category: 'Leafy and Salad', Id: 'item9' },
{ text: 'Wheat grass', Category: 'Leafy and Salad', Id: 'item10' },
{ text: 'Yarrow', Category: 'Leafy and Salad', Id: 'item11' }
];
</code> |
|
<code>
this.tagging = function(e) {
if (e.itemData["Category"] == "Vegetables") {
e.setClass("GroupHead");
}
}
</code> |
|
<code>
this.chipSelection = function(e){
var msObj = document.getElementById('group').ej2_instances[0];
var grouphead = false, subitems = [];
for (var i = 0; i < msObj.listData.length; i++) {
if (msObj.listData[i].Category == e.target.textContent) {
grouphead = true;
subitems.push(msObj.listData[i]);
}
}
if (grouphead && subitems.length > 0) {
var select = [];
for (var i = 0; i < subitems.length; i++) {
select.push(subitems[i].Id)
}
var array = msObj.value;
for (var i = 0; i < msObj.listData.length; i++) {
if (msObj.listData[i].text == e.target.textContent) {
var index = array.indexOf(msObj.listData[i].Id);
if (index > -1) {
array.splice(index, 1);
}
}
}
for(var i = 0; i < array.length; i++){
select.push(array[i]);
}
var unique = select.filter(function(elem, index, self) {
return index == self.indexOf(elem);
});
msObj.inputFocus = false;
msObj.value = unique;
msObj.dataBind();
}
}
</code> |