Reputation: 41
I am using w2grid with drop down list and chackbox. I have a problem with the built in advanced search. When I select a state which one of the users posses (e.g. Active), all rows are removed and nothing is displayed. Similarly, when I want to search manager: true, no record is displayed.
The configuration of the grid follows:
let config = {
grid: {
name: 'usersadmingrid',
style: 'border: 1px solid #efefef',
header: 'Users',
show: {
header: true,
toolbar: true,
},
multiSearch: true,
multiselect: false,
searches: [
{ field: 'email', text: 'Email', type: 'text' },
{ field: 'stateId', text: 'State', type: 'list', options: {items: userStates}, },
{ field: 'manager', text: 'Manager', type: 'list', options: {items: [{id: true, text: 'yes'}, {id: false, text: 'no'}]}, },
],
columns: [
{ field: 'email', text: 'Email', size: '150px', sortable: true, searchable: true, },
{ field: 'stateId', text: 'State', size: '100px', sortable: true, searchable: true,
editable: { type: 'list', items: userStates, showAll: true, openOnFocus: true},
render(record, extra) { return record.stateName; }
},
{ field: 'manager', text: 'Manager', size: '100px', resizable: true, sortable: true , style: 'text-align: center',
editable: { type: 'checkbox', style: 'text-align: center' }
},
],
records: users,
}
}
I implemented the onChange method. When a new item is chosen from the drop down list, the record's stateId and stateName is set properly.
I use the following variables:
let userStates = [{id: 0, text: 'Active'}, {id: 1, text: 'Inactive'}, {id: 2, text: 'External'}];
let users = [
{recid: 1, email: '[email protected]', stateId: 0, stateName: 'Active', manager: true},
{recid: 2, email: '[email protected]', stateId: 1, stateName: 'Inactive', manager: false},
];
Why the search does not return any record?
Is some cases the search window works strange. e.g. for the ceckbox iy I choose no, no text is displayed in the search textbox. What causes is strange behavior?
Please help me fix the search issues. Thank you.
Upvotes: 0
Views: 9