View Full Version : Support for the plebes among us: SOLVED - gotcha with "checkColumn"

Mike Robinson
30 Oct 2009, 7:59 AM
I didn't want the "plebes" among us /:) to miss out on this little support-tidbit that I just found.

If you look at the "checkcolumn" user-extension plugin, a couple of things about the example are very important, but not obvious:

The plugin is first instantiated as a separate var, which in the example just happens to be named "checkcolumn." Why is that, you say?
... because the object must also be listed as a plugin to the grid ...
... and notice the following: in the "plugins: [checkcolumn]" directive there are no quote-marks around the name, "checkcolumn." The reference is to the var just created; not to the "ptype" of the same name.\

I do not choose to oblige you to pay money to me for me to explain why "plugins: ['checkcolumn']" would produce the effect of "a check-column that appears but that can never be checked." The reason is that a plugin can be successfully found by a quoted-name (a "ptype"), but doing so creates a new plugin-instance. So the plugin-instance gets invoked by an event-listener that sees the column-instance of "this."

The instance generated by the plugins declaration was instantiated without any config properties. It will have an auto-generated id but no other properties. It is not the same object-instance that you placed into your grid's column-model (no matter whether you used the cm or the columns property to do so).

As it turns out, there are several components out there which exhibit this same kind of "gotcha." (It's actually a defensible "gotcha" once you understand what is happening.) In general, if you're dealing with a plugin that visually participates in whatever it is that you see, as in this case, you'll need to make sure that the "plugins:" list-entry is not a quoted-string, but the plugin object itself.

Now you know. And it didn't cost you a dime.