I'm using Oleg's select2 demo, but I am wondering whether it would be possible to change the currently selected value in the dropdown menu.
For example, if the four values loaded were: "Any", "Fruit", "Vegetable", "Meat"
and the dropdown list defaulted to "Any"
, how would I be able to change that to "Fruit"
in the JqGrid event loadComplete
?
Is this possible?
This should be even easier.
But make sure the values which you pass are already present in the HTMl
You have two options - as @PanPipes answer states you can do the following.
This is an acceptable solution only if one doesn't have any custom actions binded to the change event. The solution I use in this situation is to trigger a select2 specific event which updates the select2 displayed selection.