onChange: function(args) {
var multiSelectObj = this.$refs.multiSelectObj.ej2Instances;
if (multiSelectObj.viewWrapper) {
multiSelectObj.viewWrapper.style.display = 'none';
}
multiSelectObj.chipCollectionWrapper.style.display = 'block';
let inputPos = multiSelectObj.overAllWrapper.getBoundingClientRect()
let popupPos = multiSelectObj.popupWrapper && multiSelectObj.popupWrapper.getBoundingClientRect();
if (inputPos && popupPos && (inputPos.top + inputPos.height > popupPos.top)) {
multiSelectObj.popupWrapper.style.top = (inputPos.top + inputPos.height) + 'px';
}
},
onSelect: function(args) {
var multiSelectObj = this.$refs.multiSelectObj.ej2Instances;
multiSelectObj.addChip(args.itemData.Game, args.itemData.Id, args.e);
setTimeout(this.onChange, 5)
},
onCreated: function() {
var multiSelectObj = this.$refs.multiSelectObj.ej2Instances;
multiSelectObj.chipCollectionWrapper = multiSelectObj.createElement('span', {
className: 'e-chips-collection',
styles: 'display:none'
});
multiSelectObj.componentWrapper.appendChild(multiSelectObj.chipCollectionWrapper);
//multiSelectObj.value = ['Game1','Game2']; // You can set the preselect the value
},
onFocus: function(args) {
document.getElementsByClassName('e-delim-view')[0].style.display = 'none';
},
onSelectAll: function(args) {
var multiSelectObj = this.$refs.multiSelectObj.ej2Instances;
multiSelectObj.hidePopup();
},
onRemove: function(args) {
setTimeout(this.onChange, 5);
}, |
It's more straightforward to shift over to using the Dropdown Tree component, which supports checkboxes with chips out of the box.
https://stackblitz.com/edit/angular-gzmh4z?file=app.component.ts
Hey, I have a quick question on this. I'm about to implement dropdown tree with checkbox and chips in angular.
The concern for me here is when the dropdown tree loses focus, the values selected are not displayed as chips rather it is displayed as a comma separated values.
I went through your documentation and several forum discussions, none could help me in achieving this.
The objective is to display the values as chips even after focusing out. Does ejs-dropdown provides feasibility to get to this?
Any help would be highly appreciated. Thanks in advance.
Kindly find the screenshot and stackbiltz link below:
stackbiltz link: https://stackblitz.com/edit/angular-gzmh4z-xcxmf2
screenshot:
Hi Rahul,
Greetings from Syncfusion support.
Based on the details shared, we understand that you want to display the selected values in the Dropdown Tree input as a Chip structure. You can meet this requirement by enabling the mode attribute and setting the value to Box, which will help visualize the selected items as chips. Please refer to the sample and code snippets below for further assistance.
Sample : https://stackblitz.com/edit/angular-gzmh4z-q4kgwv?file=app.component.html,app.component.ts
[app.component.html] <ejs-dropdowntree #defaultCheck id="checkbox" [fields]="field" [showCheckBox]="showCheckBox" [mode]="mode" … ></ejs-dropdowntree>
[app.component.ts] public mode = 'Box'; |
Refer the above shared details and get back to us if you need any further assistance.
Regards,
Leo Lavanya Dhanaraj
Hi Lavanya,
This doesn't work for multiple values i.e., when more than one is selected in dropdown and focusing out, I still want the selected values to be displayed in chips.
Stackbiltz: https://stackblitz.com/edit/angular-gzmh4z-q4kgwv?file=app.component.html,app.component.ts
Let me know for further inputs from my side
Kindly find the screenshot below for your reference:
Expected:
Actual:
Rahul, based on your shared screenshot, we understand that you want to display all the selected values in the Dropdown Tree input box as Chips. You can meet this need by enabling the wrapText property and set value as true.
Check out the below sample link, code snippet and output screenshots for further assistance.
Sample : https://stackblitz.com/edit/angular-gzmh4z-rts51u?file=app.component.html,app.component.ts
<ejs-dropdowntree #defaultCheck id="checkbox" [showSelectAll]="true" [showClearButton]="true" [allowFiltering]="true" [fields]="field" [wrapText]="true" [showCheckBox]="showCheckBox" [mode]="mode" [selectAllText]="'Select All'" popupHeight="220px" placeholder="Select items" ></ejs-dropdowntree> |
Output screenshot:
|
Hi Lavanya,
Thanks for your assistance. But there is one more issue that I wanted to be addressed.
Selecting the results filtered based on the search key enables Select All checkbox despite of selecting only few and not all options from the dropdown.
For instance, type new in the searchable area of the dropdown in the below stackbiltz and check the checkbox of New South Wales. Then, clear the search result and observe the select all checkbox, it'll be checked despite of selecting one option from the list
Stackbiltz: https://stackblitz.com/edit/angular-gzmh4z-rts51u?file=app.component.html,app.component.ts
Thanks in advance.
Kindly find the screenshot below for your reference:
Screenshot:
Hi Rahul,
Based on the shared details, we have validated the mentioned issue with the Angular Dropdown Tree component(Issue with the showSelectAll property after performing the filtering action in DDT), and we have considered it as a bug on our end. The fix for this issue will be included in our weekly patch release, which is expected to be released in the first week of July 2024.
You can track the status of the fix through the following link.
Disclaimer: Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.
We appreciate your patience.
Regards,
Leo Lavanya Dhanaraj
Hi Rahul,
Thanks for your patience.
We are glad to announce that our patch release (V26.1.40) has been rolled out successfully. The issue with the showSelectAll property, which occurred after performing the filtering action in the Dropdown Tree component, has been resolved in this release.
To access this fix, we suggest you update the package to 26.1.40 and we include the sample in the latest version for your reference.
Sample : https://stackblitz.com/edit/angular-gzmh4z-apjzb3?file=app.component.ts
Release Notes : https://ej2.syncfusion.com/angular/documentation/release-notes/26.1.40?type=all#bug-fixes-5
Regards,
Leo Lavanya Dhanaraj