AllowTextWrap in dropdownlist

Hi, I want to warp dropdownlist in dropdownedit datagrid. Can you help me?


7 Replies 1 reply marked as answer

SK Sujith Kumar Rajkumar Syncfusion Team June 17, 2021 12:12 PM UTC

Hi Toan, 
 
Greetings from Syncfusion support. 
 
We are not able to clearly understand your requirement from the provided information. Do you wish to customize the properties of the default edit dropdown in the Grid? If so, you can achieve it by using the cell edit params property of the column which allows to customize the behavior of the edit component. 
 
We have demonstrated this case in the below code snippet and sample prepared for your reference where, the clear button is enabled for the dropdown edit column, 
 
app.component.html 
<ejs-grid [dataSource]='data' ...> 
    <e-columns> 
        <e-column field='ShipCountry' editType='dropdownedit' [edit]='editparams'></e-column> 
    </e-columns> 
</ejs-grid> 
 
app.component.ts 
public ngOnInit(): void { 
    this.editparams = { params: { showClearButton: true } }; 
} 
 
 
More details on cell edit params and the EJ2 dropdown component can be checked in the below documentation links, 
 
                               https://ej2.syncfusion.com/angular/documentation/drop-down-list/getting-started/ 
 
If this is not your requirement, then please elaborate on it in order to understand it better.  
 
Regards, 
Sujith R 



TB Toan Bui June 18, 2021 01:46 AM UTC

Thanks for your answer. However, I need to custom my dropdown elements in the datagrid because they are too long. I want to break line it so users can see all information

The picture below is an example: the text can't be displayed at all




SK Sujith Kumar Rajkumar Syncfusion Team June 18, 2021 09:36 AM UTC

Hi Toan, 
 
Since your requirement is to display the entire dropdown text values in place of the ellipsis, we suggest you to achieve the same by increasing the popup width with the popupWidth property using the cell edit params. 
 
This is demonstrated in the below code snippet, 
 
this.editparams = { params: { popupWidth: 200 } }; 
 
Please find the modified sample for your reference below, 
 
 
 
If we misunderstood your query or if you require any further assistance with this, then please get back to us. 
 
Regards, 
Sujith R 



TB Toan Bui June 22, 2021 07:46 AM UTC

my data is too long to display on the screen. Can I down the line of them?



SK Sujith Kumar Rajkumar Syncfusion Team June 23, 2021 12:55 PM UTC

Hi Toan, 
 
For displaying long data in the dropdownlist item, we suggest you to use the EJ2 Tooltip component to display the item text on hovering the dropdown. This can be achieved by initializing the EJ2 Tooltip component by setting its target property value(target element where the tooltip needs to be displayed) as ‘e-list-item’(denotes the dropdown item element’s class) and append it to the body element. Now in the tooltip’s beforeRender event, the current target element’s inner text(list item text in this case) is set as the tooltip’s content property. 
 
This is demonstrated in the below code snippet, 
 
import { Tooltip, TooltipEventArgs } from '@syncfusion/ej2-popups'; 
 
ngAfterViewInit(){ 
    //Initialize Tooltip component 
    this.tooltip = new Tooltip({ 
        // set target element to tooltip 
        target: '.e-list-item', 
        // set position of tooltip 
        position: "TopCenter", 
        // Triggers before the tooltip is rendered 
        beforeRender: this.onBeforeRender.bind(this) 
    }); 
    this.tooltip.appendTo('body'); 
} 
 
// Tooltip’s beforeRender event handler 
onBeforeRender(args: TooltipEventArgs): void { 
    // The current target item element text is set as the tooltip content 
    this.tooltip.content = args.target.innerText; 
    // The tooltip is properly updated with the dynamically changed content 
    this.tooltip.dataBind(); 
} 
 
Finally, this tooltip is closed by calling its close event in the edit dropdown’s close event handler which is bound using the column edit params property. 
 
<e-column field='ShipCountry' editType='dropdownedit' [edit]='editParams'></e-column> 
 
public editParams = { params: { close: this.onClose.bind(this) } } 
 
// Edit dropdown’s close event handler 
onClose(args) { 
    this.tooltip.close(); 
} 
 
We have modified the previously shared sample based on this for your reference. You can find it below, 
 
 
More details on this can be checked in the below links, 
 
                               https://ej2.syncfusion.com/angular/documentation/drop-down-list/how-to/tooltip/ 
 
 
Let us know if you have any concerns. 
 
Regards, 
Sujith R 


Marked as answer

TB Toan Bui June 24, 2021 02:11 AM UTC

I did it. Thank you so much!



SK Sujith Kumar Rajkumar Syncfusion Team June 24, 2021 07:12 AM UTC

Hi Toan, 
 
You’re welcome. We are glad to hear that your query has been resolved. 
 
Regards, 
Sujith R 


Loader.
Up arrow icon