View Full Version : Use other components (buttons etc) in View component?

29 Aug 2012, 5:36 PM
In the View component, we effectively design a custom component to use. This is great when you need to add something completely new with a different look... But what about when you want parts of it to mimic the existing appearance?

As an example I'm designing a view to display a list of jobs recently accessed, it uses a TPL that looks like this;

<table style="height:100%;">
<tr><td style="vertical-align:middle;">Recent Jobs:
<tpl for="."><span class="job">{[xindex !== 1 ? ", " : ""]}
<span onclick="Ext.getCmp('recentjobs').openJob({jobno});">{jobno}</span>
So you Get:

Recent Jobs: 1, 2, 3

But when i tried using buttons instead of plain text it was horrible... grey generic browser buttons in the middle of the schmick sleek sencha layout... I was savy enough to inspect the elements and try and include the classes and tags that the other buttons in the menu include (
x-btn-inner, x-btn-outer) they were pretty much ignored for some reason.

I'm interested in why this happened, but i'm more interested in finding out if there is any support or interest in coding ExtJS components directly into TPL... I mean, it's already accepting an array of HTML elements, would it not be possible, maybe even beneficial to allow elements of that array to be JS code to generate components, then have them added in at that point?

Any insights as to where i was going wrong or whether my suggestion is a good/bad idea are more than welcome.