We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Grid filter formatting

Good afternoon,

I need the grid filter (filter type = menu) to have a limitation of values (0% to 100%) and at the same time understand that 18% is 18 and not 0.18.

Grid column code:

<e-column field = 'Aliquot' headerText = 'Aliquot' [filter] = "{type: 'Menu'}" format = 'P2' textAlign = 'Left' width = '12% '> </ e-column>

The following image is an example.

I'm waiting and grateful for the attention,

Júlio Cézar Mendonça

Attachment: Aliquot_e4381d63.zip

3 Replies

TS Thavasianand Sankaranarayanan Syncfusion Team May 10, 2019 01:45 PM UTC

Hi Julio, 
 
Greetings from Syncfusion support. 
 
We have checked your query and you can achieve your requirement by using the format property of Numeric textbox. Please refer the below code snippet, sample link and documentation link. 
 
[app.component.ts] 
@Component({ 
    selector: 'app-root', 
    templateUrl: 'app.component.html', 
    styleUrls: ['app.component.css'], 
    providers: [FilterService] 
}) 
export class AppComponent { 
    public data: Object[]; 
     public filter: any; 
     public dropInstance: NumericTextBox; 
    @ViewChild('grid') 
    public grid: GridComponent; 
   public filterOptions: FilterSettingsModel; 
 
    ngOnInit(): void { 
        this.data =[ . . . . 
]; 
        this.filterOptions = { 
           type: 'Menu' 
        };         
    } 
    constructor(){ 
    this.filter = { 
            ui: { 
                create: (args: { target: Element, column: object }) => { 
                    const flValInput: HTMLElement = createElement('input', { className: 'flm-input' }); 
                    args.target.appendChild(flValInput); 
                    this.dropInstance = new NumericTextBox({ 
                        format: "###'%'" 
                    }); 
                    this.dropInstance.appendTo(flValInput); 
                }, 
                write: (args: { 
                    column: object, target: Element, parent: any, 
                    filteredValue: number 
                }) => { 
                    this.dropInstance.value = args.filteredValue; 
                }, 
                read: (args: { target: Element, column: any, operator: string, fltrObj: Filter }) => { 
                    args.fltrObj.filterByColumn(args.column.field, args.operator, this.dropInstance.value); 
 
                } 
            } 
        }; 
    } 
} 
 


Please get back to us for further assistance. 
 
Regards, 
Thavasianand S. 



JC Julio Cezar Mendonca May 10, 2019 04:12 PM UTC


Worked perfectly. Thank you for your help.


TS Thavasianand Sankaranarayanan Syncfusion Team May 13, 2019 05:06 AM UTC

Hi Julio, 
 
We are happy that the problem has been solved. 
 
Please get back to us if you need any further assistance.  
                          
Regards, 
Thavasianand S.

Loader.
Live Chat Icon For mobile
Up arrow icon