PDA

View Full Version : How customize a groupTextTpl to show the value of another column



Pachat
20 Feb 2010, 10:01 AM
In a GridPanel which store is a GroupingStore, i have a GroupingView

table_projects = new Ext.grid.GridPanel({
store: store_projects,
view: new Ext.grid.GroupingView({
groupTextTpl: '{text} ( {[values.rs.length]} {[values.rs.length > 1 ? "projects" : "project"]} )'
}),
The groupField is "status".


store_projects = new Ext.data.GroupingStore({
url: 'projects.php',
reader: reader_projects,
groupField:'status',
sortInfo: {field: 'date_investment', direction: 'ASC'},
writer: new Ext.data.JsonWriter()
});
But I would like to have the groups ordered by the "order" of the "satus" which is in a reference table of "status" to which the table "projects" is linked.


SELECT p.project_name, ..., p.status, s.order
FROM projects p INNER JOIN status s ON s.status = p.status
ORDER BY s.orderIf I put groupField:'order', on every group title, i get the "order" shown (ex. "7" as {text} renders it), but what i would like to have is in fact the associated "status" (ex. "finished") : is there a way to retreive the "status" value of the current row ?

Alternatively, is there a solution to have the groupField set to "status" with the groups being ordered not alphabetically, but by another column (s.order) ?