Reputation: 509
Im using ExtJS 3.3 and i have a combobox, what im trying to do is prevent the click action on certain items in the combobox.
The code im using is as follows;
listeners: {
beforeselect: function(combo, record, index, e) {
if(record.json[3] === false) {
e.stopEvent();
}
}
},
It actually works, preventing a user from clicking an item, but the problem is that it also causing an error, as follows;
Cannot read property 'stopEvent' of undefined
If anyone has managed to get this going without causing an error message, that would be awesome if you could share it.
Cheers,
Upvotes: 1
Views: 53
Reputation: 20234
Have you checked the docs? They state the beforeselect
event doesn't have four parameters.
To prevent the selection, as per the same docs:
Return false to cancel the selection.
So to summarize:
listeners: {
beforeselect: function(combo, record, index) {
if(record.json[3] === false) {
return false;
}
}
},
Upvotes: 2