PDA

View Full Version : Ext.ux.plugins.grid.CellToolTips - if statement



epi82
10 Sep 2010, 6:18 AM
Hello,

I'm trying this plugin to my GridPanel.


var cellTips = new Ext.ux.plugins.grid.CellToolTips([
{ field: 'family', tpl: '<b>Family: <i>{family}</i>' }
]);

Is it possible to insert in "tpl" a conditional statement by a function?

Something that can show a different text from the record value. For example:
if {family}='A' return 'Example type A'
elseif {family}='B' return 'Example type B'

Thank you very much.

Condor
10 Sep 2010, 6:24 AM
Specify the tpl as an Ext.XTemplate instance and use <tpl if="...">...</tpl> in your template.

epi82
10 Sep 2010, 7:05 AM
I've done this:


var cellTips = new Ext.ux.plugins.grid.CellToolTips([
{ field: 'family', tpl: '<tpl if="family==\'A\'"><b>Example type A</b></tpl>' }
]);

and works good! Thank you very much Condor!