View Full Version : displayField renderer or 'load'-like event ?

24 Sep 2010, 5:49 AM
Hi there!

I am trying to find something that does the same thing as for GridPanel's column renderer, but for a displayField widget instead, to no avail.

I even opened the displayField.js widget file and could not find any event in there that could let me modify the data held in it when the widget is created, like a load or create event.

Any idea how could one do this ?


EDIT: I found this http://www.sencha.com/forum/showthread.php?62951-OPEN-640-DisplayField-to-be-able-to-format-data but I am not sure as to how to simulate a load() create() event or renderer.

24 Sep 2010, 6:04 AM
You could use set its template and control its appearance/contents that way?

24 Sep 2010, 6:39 AM
Thanks, but I found this:

Ext.override(Ext.form.DisplayField, {
setValue: function(v) {
if (v.indexOf('P1') > -1) {

returnText = '<font color="red">' + v + '</font>';

returnText = v;

return this;

Does exactly what I want. I never really got into Ext.override and it's quite useful. :)

25 Sep 2010, 6:47 AM
Be careful that this will do this logic for every displayfield in your app.