Ticket T435406
Visible to All Users

DataGrid - How to perform accent-insensitive search

created 9 years ago

Hi,

I've been looking for a solution for my problem here without success, I implemented a dxGrid for my project, everything works fine except that we're using latin accents, I enabled search bar for this grid but the search is case/accents sensitive, how can I disable this behavior? I already change my database collation and I have performed some queries there and it works. I'm populating my dxGrid using a JSONResponse. I attach the definition of my dxGrid and a sample dataset.

I would really appreciate your help.

Thanks

Answers approved by DevExpress Support

created 9 years ago (modified 2 years ago)

Hello Alejandro,

Updated:

The DataSource component can now sort and filter data by a locale with special characters (for example, symbols with diacritics). Specify locale and collator options in the langParams object to implement this functionality: What's New Data Layer.

You can download the devextreme@23.1 package for testing:

Previous versions:

You can use the calculateFilterExpression option for this purpose. For example:

JavaScript
..... columns: [ ..... { dataField: 'PrisonDesc', caption: 'Facility Name', width: 700, allowEditing: false, calculateFilterExpression: function(filterValue, selectedFilterOperation, target){ var getter = function(data) { return data['PrisonDesc'].normalize('NFD').replace(/[\u0300-\u036f]/g,""); }; filterValue = filterValue.normalize('NFD').replace(/[\u0300-\u036f]/g,""); return [getter, selectedFilterOperation || "contains", filterValue]; } }, ..... ], .....

See also:
String.prototype.normalize()
Combining Diacritical MarksRemove accents/diacritics in a string in JavaScript

    Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

    Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.