0

I'm using ExtJs 3.4 and have the following code to create a hidden field:

box.hidden = this.el.insertSibling({
    tag: 'input',
    type: 'hidden',
    value: itemVal,
    name: (this.hiddenName || this.name)
}, 'before');

However, when itemVal is a json-string (or a string with quotation characters) it creates an element that looks like:

<input type="hidden" value="[" 635f7ede-7add-415f-8461-548d17027cac.group","bbe2x:101"]"="" name="selector_account_ef8e33ca71e749dca21997f51b404e23" id="ext-gen1766">

The problem is that it cocatenates the html for performance. So I want to, in this case, create the element by setting Ext.DomHelper.useDom to true. Should be an easy fix, right? But the inner code that checks the useDom variable checks against the private object that is passed to Ext.apply function instead of using Ext.DomHelper.useDom. So it doesn't matter if i set Ext.DomHelper.useDom to true inside the function that checks it, it is never true. Se the ExtJs code here:

http://docs.sencha.com/ext-js/3-4/source/DomHelper-more.html

// private
function doInsert(el, o, returnElement, pos, sibling, append){
    el = Ext.getDom(el);
    var newNode;
    if (pub.useDom) {
       ...
    } else {
       ...
    }
    return returnElement ? Ext.get(newNode, true) : newNode;
}

I found an old bug report for this that was closed, (http://www.sencha.com/forum/showthread.php?76966-CLOSED-3.0.0-DomHelper-s-useDom-bug) but I don't understand why and HOW I can set useDom to true.

Of course it's simple to fix it by replacing " to &quot; but I want to understand it.

Torbjörn Hansson
  • 18,354
  • 5
  • 33
  • 42
  • isn't `pub.useDom` pointing to `Ext.DomHelper.useDom`, pub is an object which is returned in the closure scope to make it public properties of the class – Saket Patel Apr 12 '12 at 10:46
  • @SilentSakky Unfortunately it's not the same object. pub is the object that is used to apply (Ext.apply) to Ext.DomHelper so it's private. – Torbjörn Hansson Apr 12 '12 at 11:37

0 Answers0