Parameters for groupTextTpl
I have a grouping view working, but I would like to enhance a little bit :D
My question is, how can I change the groupTextTpl option, to see the lei field instead lei_id ?
var ds = new Ext.data.GroupingStore({
proxy: new Ext.data.HttpProxy({url: '/pesquisa/lei_grid'}),
reader: new Ext.data.JsonReader({
root: 'ComponenteLei',
totalProperty: 'Total',
id: 'id'
}, [
{name: 'id',mapping: 'id'},
{name: 'lei_id',mapping: 'lei_id'},
{name: 'lei',mapping: 'lei'},
{name: 'texto', mapping: 'texto'}
]),
sortInfo:{field: 'id', direction: "ASC"},
groupField:'lei_id'
});
var gview = new Ext.grid.GroupingView({
forceFit:true,
groupTextTpl: '{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Artigos" : "Artigo"]})'
});
I tried:
'{values.rs[0].lei} ({[values.rs.length]} {[values.rs.length > 1 ? "Artigos" : "Artigo"]})'
but I got the text "values.rs[0].lei (1) Artigo".
Thanks in advance !
Sal
I don't know (I'm a newbie) , what I know is that the renderer will replace the {text} part of groupTextTpl. I didn't tried to use it without the groupTextTpl template.
s...
rosaldanha
Have a try with
groupTextTpl: '{[ values.rs[0].data["storefieldname"] ]}'
this should works
P.S: remember to use inner the {} template markers.
groupTextTpl: '
'
Philou
But is it possible to change the text template back to default once the user selects Group By this Field from one of the column headers
I found an workaround.
I created a custom renderer for the lei_id field:
var cm = new Ext.grid.ColumnModel
([
{id: 'id', header: "id",dataIndex: 'id', width: 10,hidden:true},
{header: "Lei",dataIndex: 'lei_id', width: 10, hidden:true, renderer: renderLei},
{header: "",dataIndex: 'texto', width:250, renderer: renderArtigo}
]);
// this custom renderer will show what I need, the "lei_nome" field instead the lei_id field.
function renderLei(value, p, record){
return String.format('{0} Vigência:({1})', record.data.lei_nome,record.data.vigencialei);
}
We don't need special groupTextTpl, just define custom renderer for groupField. Am I right?
Can anyone help?
Have a try with
groupTextTpl: '{[ values.rs[0].data["storefieldname"] ]}'
this should works
P.S: remember to use inner the {} template markers.
works great! thank you! ;)
But is it possible to change the text template back to default once the user selects Group By this Field from one of the column headers
Ok i'm a dude, but i'm not sure what do you mean...
Can't you add the groupField in groupTextTpl as parameter in future release? It would be really nice feature to have.
Thanks,
Daniel W
#If you have any other info about this subject , Please add it free.# |

