Understanding Coolite ComboBox Mode

This week I came across a very valuable piece of information concerning Coolite combo boxes.  A combobox has attribute called Mode. What this is set to greatly affects the overall behavior of the control, and can create extra queries where you may not expect them.  I find that having an understanding of this attribute can help you develop more efficient pages using the Coolite ComboBox.

  • Default – The default behavior for this control is based on how it initially receives its data.  If it is connected to a Store of any kind, it will act according to the rules of Remote if no store is provided it will act according to the rules of Local
  • Remote – whenever the dropdown is expanded make a query to the data store to get the latest data and bind the data according to the DisplayField and ValueField.  This is where the second query comes in.  Even setting AutoLoad to true on the Store will cause this to happen. Be wary of this second query, especially if the query to get the data is heavy, this could easily create a bottleneck
  • Local – once the data is loaded do not go out and get new data unless load is called on the Store.  This has the greatest chance of working with potentially stale data (depending on your model) but is also the most efficient as it allows you to control when loads happen.  Remember, you can easily tell your Store to load by calling the load() method on the store via JavaScript

So what is the best approach, well as my college mentor Dr. George Nezlek used to say “it depends”. I would say for the majority of these calls you are better off explicitly defining the the Mode as Local and controlling the loading of the store through JavaScript and event handlers.  However, if the user is going to spend a lot of time on the page and the data is critical and very likely to change, Remote may be the better option.

I would assume there is a way to define poll time for the DropDown query, however, I have not explored that, but something I would look at for the later case.

Hope this was helpful, I discovered this and, as usual, found no documentation from Coolite explaining this, so I thought it would be useful to talk about it here.


One thought on “Understanding Coolite ComboBox Mode

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s