Fixed a few typos, improved column searching, if a searcher is not defined, it will now make sure the value is a string before applying the regex, if a searcher is defined it now runs that.
This commit is contained in:
		@@ -37,7 +37,7 @@ class DataColumn extends IgniteObject {
 | 
				
			|||||||
    comparer = null;
 | 
					    comparer = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * A custom function used for searching, default is null.
 | 
					     * A custom function(value, searchStr, regex) used for searching, default is null.
 | 
				
			||||||
     * @type {IgniteProperty|Function}
 | 
					     * @type {IgniteProperty|Function}
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    searcher = null;
 | 
					    searcher = null;
 | 
				
			||||||
@@ -76,7 +76,7 @@ class DataColumn extends IgniteObject {
 | 
				
			|||||||
     * @param {IgniteProperty|Function} options.selector A function to extract the column value from given data. Default is null.
 | 
					     * @param {IgniteProperty|Function} options.selector A function to extract the column value from given data. Default is null.
 | 
				
			||||||
     * @param {IgniteProperty|Function} options.converter A function to convert the column value to a custom component. Default is null.
 | 
					     * @param {IgniteProperty|Function} options.converter A function to convert the column value to a custom component. Default is null.
 | 
				
			||||||
     * @param {IgniteProperty|Function} options.comparer A function to compare two columns for sorting. Default is null.
 | 
					     * @param {IgniteProperty|Function} options.comparer A function to compare two columns for sorting. Default is null.
 | 
				
			||||||
     * @param {IgniteProperty|Function} options.searcher A function to seatch a column. Default is null.
 | 
					     * @param {IgniteProperty|Function} options.searcher A function(value, searchStr, regex) to search a column. Default is null.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    constructor(name, options = null) {
 | 
					    constructor(name, options = null) {
 | 
				
			||||||
        super();
 | 
					        super();
 | 
				
			||||||
@@ -456,8 +456,12 @@ class DataTable extends IgniteElement {
 | 
				
			|||||||
                for (var i = 0; i < this.columns.length; i++) {
 | 
					                for (var i = 0; i < this.columns.length; i++) {
 | 
				
			||||||
                    var value = row.values[i] instanceof IgniteProperty ? row.values[i].value : row.values[i];
 | 
					                    var value = row.values[i] instanceof IgniteProperty ? row.values[i].value : row.values[i];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    if (this.columns[i].searchable && value && value.match(regex)) {
 | 
					                    if (this.columns[i].searchable) {
 | 
				
			||||||
                        return true;
 | 
					                        if (this.columns[i].searcher && this.columns[i].searcher(value, this.filterSearch, regex)) {
 | 
				
			||||||
 | 
					                            return true;
 | 
				
			||||||
 | 
					                        } else if (value && typeof value == 'string' && value.match(regex)) {
 | 
				
			||||||
 | 
					                            return true;
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user