Auto Search functionality in Wijmo Library 5.20153.102

Posted by: rambabu on 31 January 2019, 10:44 pm EST

    • Post Options:
    • Link

    Posted 31 January 2019, 10:44 pm EST

    Hello Wijmo Team,

    I have a requirement in my project to highlight the rows in the grid. I see that this functionality(autoSearch property) is included in Wijmo Library 5.201801.462.

    Is there any way I can implement the auto search functionality in my current WIJMO library 5.20153.102.

    I don’t want to upgrade to the latest version of wijmo as there are a lot of breaking changes.

    please help.

    Thanks & Regards

    Teja Gudivada

  • Posted 3 February 2019, 3:59 pm EST

    Hi,

    AutoSearch action is perfomed on the grid as the users types into read-only cells.

    The search happens on the column that is currently selected, if it is not editable. The search starts at the currently selected row and is case-insensitive.

    Howevere your requirements seem regarding highlight of rows, could you please elaborate on this so that we can help you accordingly.

  • Posted 3 February 2019, 8:42 pm EST

    Hello Abhishek,

    Currently, the wijmo library 5.20153.102, doesn’t have auto-search functionality implemented, is there any way I can implement the functionality for the Library I am using.

    Please let me know if you have any questions.

    Thanks & Regards

    Teja Gudivada

  • Posted 3 February 2019, 10:06 pm EST

    Hi,

    We are sorry but there isn’t a way to accomplish this functionality . I would suggest you to upgrade to the latest build,

  • Posted 7 February 2019, 2:03 am EST

    this.autoSearch=false;

    var _thisGridObj =this;

    this.hostElement.addEventListener(‘keypress’, function (e) {

    //logic for autoSearch

    if ( _thisGridObj.autoSearch) {

    var d = !1,

    s = _thisGridObj.selection,

    o = _thisGridObj;

    if (e.charCode > 32 || 32 == e.charCode && _thisGridObj._search) {

    e.preventDefault(), _thisGridObj._search += String.fromCharCode(e.charCode).toLowerCase(), _thisGridObj._toSearch && clearTimeout(_thisGridObj._toSearch), _thisGridObj._toSearch = setTimeout(function () {

    _thisGridObj._toSearch = null, _thisGridObj._search = “”

    }, 500);

    var g = _thisGridObj._findNext(s.row, s.col);

    g < 0 && _thisGridObj._search.length > 1 && (_thisGridObj._search = _thisGridObj._search[_thisGridObj._search.length - 1], g = _thisGridObj._findNext(s.row, s.col)), g > -1 && (d = !0, o.select(g, s.col))

    }

    }

    });

    }

    FlexGrid.prototype._findNext = function (e, t) {

    var i = this,

    o = i.rows.length;

    (e < 0 || 1 == this._search.length) && e++;

    for (var n = 0; n < o; n++) {

    var r = (e + n) % o;

    if (0 == i.getCellData(r, t, !0).trim().toLowerCase().indexOf(this._search)) return r

    }

    return -1

    }

    Added the following code to my existing wijmo library and it is working.

  • Posted 7 February 2019, 3:19 pm EST

    We are glad to hear that you were able to solve the issue and thanks for sharing your approach.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels