Adds a search or searches to the grid.
addSearch([before], search)

before | string or integer, optional, search to add before
search | object or array, search(s) to add

Returns integer.

#### Description

Adds a search or searches to the grid by adding items into .searches array. Since the search popup is shown when user clicks the search button, there is no need to refresh the grid. The first optional argument before is the search to insert before. It can be either a search field name or the index in the .searches array. If first parameter is not defined, the search will be appended to the end. Second argument search is the search object or an array of search objects.
Returns the number of searches it adds.
If you define grid as: $('#grid').w2grid({ name : 'grid', columns: [ { field: 'recid', caption: 'ID', size: '50px' }, { field: 'lname', caption: 'Last Name', size: '30%', searchable: true }, { field: 'fname', caption: 'First Name', size: '30%', searchable: true }, { field: 'email', caption: 'Email', size: '40%', searchable: true }, { field: 'sdate', caption: 'End Date', size: '120px' } ], records: [ { recid: 1, fname: 'John', lname: 'doe', email: 'vitali@gmail.com', sdate: '1/3/2012' }, { recid: 2, fname: 'Stuart', lname: 'Motzart', email: 'jdoe@gmail.com', sdate: '2/4/2012' } ] }); You can add searches by: w2ui['grid'].addSearch({ field: 'recid', caption: 'ID', type: 'int' }); or several at a time: w2ui['grid'].addSearch([ { field: 'fname', caption: 'First Name', type: 'text' }, { field: 'lname', caption: 'Last Name', type: 'text' } ]); See .searches array for the structure of the search object.