1

I am appending data to a table from within an ajax callback.

// ajax
...
success: function(data) {
 $("#some-table").bootgrid("append", data.rows);
},
..

It works as intended except the search.

Search works for a single letter but then throws this error on an additional characters rendering it unusable.

Uncaught TypeError: Cannot read property 'search' of null

Its coming from this function in the lib

function loadData()
    {
        var that = this;

        this.element._bgBusyAria(true).trigger("load" + namespace);
        showLoading.call(this);

        function containsPhrase(row)
        {
            var column,
                searchPattern = new RegExp(that.searchPhrase, (that.options.caseSensitive) ? "g" : "gi");

            for (var i = 0; i < that.columns.length; i++)
            {
                column = that.columns[i];
                if (column.searchable && column.visible &&
                    column.converter.to(row[column.id]).search(searchPattern) > -1) // this is where it breaks
                {
                    return true;
                }
            }

            return false;
        }
Angad Dubey
  • 5,067
  • 7
  • 30
  • 51

1 Answers1

0

If you have this kind of problem, you may able to set the search properties in bootgrid.

For Example :

searchSettings: { delay: 250, characters: 30(just increase the character) }

Now you may able to search but you have enter the keyword. Its like playing with script memory. But its a easiest way to do that.

vinodh
  • 714
  • 1
  • 7
  • 20