I am using the searchdata function from OutSystems DataGrid.
The returned result is not as per what I expected. For example, if I search for "Crane C", it will show result that contains either "Crane" or "C". But I actually wanted it to be "Crane C".
Example:
Search for "Crane"
Search for "Crane C"
Hi @Daus Shah
After playing around with Wijmo FlexGrid APIs on their website, I managed to find a way (even though complex) to change the search algorithm.The way to achieve that requires some complex custom JavaScript that I was able to simplify to the following:
- Add the following code in a JSNode in Grid’s OnInitialize event handler:
wijmo.grid.search.FlexGridSearch.prototype._applySearch = function () { var e = this._g; this._rxSrch = this._rxHilite = null; var t = this.text.replace(/([.?*+^$[\]\\(){}|-])/g, '\\$1'); if (t.length) { var r = e && e.caseSensitiveSearch ? 'g' : 'gi'; this._rxSrch = new RegExp('(?=.*' + t + ')', r); t = wijmo.escapeHtml(t); this._rxHilite = new RegExp('(' + t + ')(?![^<]*>)', r); } var i = e ? e.collectionView : null; i.sourceCollection && i.refresh && i.refresh(); }; // Being $parameters.GridWidgetId the Grid block identifier
- Here's the final result:
Hope it helps!
Cheers,GM
That's how the search mechanism from Wijmo Flexgrid works, so have you searched if they have a way to change the search criteria? If so, I can try to help once you share a way to do that directly in Wijmo Flexgrid.