jQWidgets Forums

jQuery UI Widgets Forums Grid Accent insensitive filtering

This topic contains 1 reply, has 2 voices, and was last updated by  admin 1 month ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Accent insensitive filtering #135794

    Hello,

    Is there a way to achieve accent insensitive search with showfilterrow = true and filtertype = ‘input’ ?

    I have halfway achieved it by setting the datafield in my column definitions to the values lowercased + without accents, and displayfield to the true values.
    That way I can find data that actually has accents without writing accents in the filterrow (e.g. I can find “Aurélien” by searching “aurelien”) ; but I also need to strip the filter value of its accents when filtering (so that I can find “aurelien” by searching “Aurélien”).

    I tried to listen on the ‘filter’ event and replace the filter value when necessary, but that triggers an infinite recursion :

    
    $grid.on('filter', function (e) {
        const filterinfo = $grid.jqxGrid('getfilterinformation');
        let hasDiff = false;
        for (let f of filterinfo || []) {
            const filterDetail = f?.filter?.getfilters?.()?.[0];
            const value = filterDetail?.value;
            if (typeof value === 'string' && filterDetail?.type === 'stringfilter') {
                const noAccent = workListGrid.removeAccents(value);
                if (value !== noAccent) {
                    $sendingsGrid.jqxGrid('removefilter', f.datafield, false);
                    const group = new $.jqx.filter();
                    const newFilter = group.createfilter(filterDetail.type, noAccent, filterDetail.condition);
                    group.addfilter(0, newFilter);
                    $grid.jqxGrid('addfilter', f.datafield, group, false);
                    hasDiff = true;
                }
            }
            if (hasDiff) {
                $grid.jqxGrid('applyfilters');
                $grid.jqxGrid('refreshfilterrow');
            }
        });
    });
    

    Do you have any tips to achieve this ?
    Thanks for your help,
    Aurélien

    Accent insensitive filtering #135805

    admin
    Keymaster

    Hi Aurélien,

    That is an interesting thing, but we do not have it for now. I added it in our To Do list.

    Best regards,
    Peter Stoev

    jQWidgets Team
    https://www.jqwidgets.com/

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.