View Full Version : Advice for a newbie - creating a toolbar for each row in a datagrid

4 Feb 2008, 4:51 AM
Hi, I hope you can help me out.

First some background... I have a Ext.DataGrid reading happily from my server using Ext.data.JsonReader and an Ext.data.HttpProxy. It renders the results using an XTemplate.

This all works beautifully and I was impressed at how well it all works together.

Now my question... I want to add some buttons for each result row in the datagrid. At first I thought of adding a Toolbar via the XTemplate but cannot figure out how to do this. So do experienced Ext users recommend:

1) Forget about the toolbar, just use HTML entities for the buttons?
2) Forget about the XTemplate and write custom rendering code?
3) There's an easy way to add Ext Elements to XTemplates, you foolish n00b!


4 Feb 2008, 5:00 AM
I assume you mean a DataView?

The method that is most often used is to have the template contain a div with a specific class that acts as a placeholder and after render use:

Ext.select('#id-of-dataview .special-class').each(function(el) {
new Ext.Toolbar({
renderTo: el,

4 Feb 2008, 6:37 AM
Yes, sorry - I meant DataView.

It all seems to work nicely if I implement your suggestion as a listener to the DataStore's load event. Even with a paging toolbar too!

Thanks for your help.