View Full Version : Displayfield and afterBodyEl for it

9 Jan 2013, 4:37 AM
I've tried to use afterBodyEl config for xtype: displayfield element
And as you can guess - unlucky.

As I could understand afterBodyEl string will be added after element with id="displayfield-1139-bodyEl" (for example)
But I've tried to use either simple string and html-markup string and nothing was appended after my displayfield.

Can anyone explain me how to use afterBodyEl?

27 Apr 2015, 5:53 AM
I faced with that problem too. I fixed it by myself, but I left a description of that behaviour here in case somebody will face with that problem too.

It's very strange and undocumented, but `afterBodyEl` depends on `msgTarget` option.
Here is the Labelable.js source code:

// Final TD. It's a side error element unless there's a floating external one
'<tpl if="msgTarget===\'side\'">',
'<td role="presentation" id="{id}-sideErrorCell" vAlign="{[values.labelAlign===\'top\' && !values.hideLabel ? \'bottom\' : \'middle\']}" style="{[values.autoFitErrors ? \'display:none\' : \'\']}" width="{errorIconWidth}">',
'<div role="presentation" id="{id}-errorEl" class="{errorMsgCls}" style="display:none"></div>',
'<tpl elseif="msgTarget==\'under\'">',
'<div role="presentation" id="{id}-errorEl" class="{errorMsgClass}" colspan="2" style="display:none"></div>',

As you see, `afterBody` works only in cases when `msgTarget` set as `under` or `side`. But, the default value for that option for Displayfield is `qtip`. The result is that afterBodyEl isn't inserted by default.

27 Apr 2015, 6:01 AM
thanks for your effort)

I haven't checked whether there is a problem in new versions of ExtJS...

27 Apr 2015, 6:47 AM
Neither have I. I'm using ExtJS 4