Component Column - Components in Grid Cells

I've written an extension to Ext.grid.column.Column that allows full-blown ExtJS 4 components to be returned from the renderer function. I know a lot of people have written custom code to do this sort of thing but as far as I'm aware no-one has ever wrapped it up in a reusable class.

The technique will be familiar to anyone who has tried to do it themselves: render the grid without the components then slip the components in afterwards. Beyond doing the obvious I've also tried to put in some size management and logic for doing component destruction.

Performance for a small number of records is absolutely fine but it should come as no surprise that it doesn't scale particularly well. The age-old technique of faking components using some HTML and CSS remains vastly superior if you need performance with a moderately large number of records. If anyone has any suggestions for improving performance that would obviously be welcome.

I hope that what my extension lacks in scaling it makes up for in saved development time. There are some demos if you follow the link but, as a taster, the code for rendering a combobox might look something like this:

I have a problem with the componentcolumn being used in a grid with a cellediting plugin. When I use a checkbox xtype in the renderer for the componentcolumn, the store's record is not updated (getUpdatedRecords() returns nothing). I also listen to the 'update' event of the store and that one is not fired. When I modify another column using an editor config (as also was this column previously), I receive the stores update event and can see that the records field value of the componentcolumn defers from what I see on the screen. Configuring the same column as an editor with a checkbox xtype the record's fields are updated (was my previous config).

Forgot to tell:
ExtJs version: 4.0.7
Browser: FF 9.0.1, FB 1.9.0.B1

Do you know what's the problem?

Thanks!

Last edited by siebe vos; 19 Jan 2012 at 12:52 AM.
Reason: Forgot to tell ExtJs and browser version

I did not get your reply on the forum via mail. Yesterday I forgot to mention the ExtJs version and browser. After I added them to my original post, I saw that you replied. This is indeed what I needed! Many thanks!

It's not easy to do that at present but I agree this would be a good feature to add. If you could let me know your use case I'll try to include it in the next version.

I think I'd do this by changing renderComponent in CTemplate. Currently it just calls the component's render method but that won't work if the component is already rendered. If that method also supported moving an existing component it should be possible to keep the same component when the grid refreshes rather than creating a new one. Without knowing your use case I don't know whether this would meet you needs.

You might be able to fake it for now by suspending events on the store but that may have other consequences.