Results 1 to 3 of 3

Thread: ActionColumn 'getClass' is not getting the data passed in

    Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-8242 in 4.2.0.489.
  1. #1
    Sencha Premium Member
    Join Date
    Apr 2012
    Posts
    3
    Vote Rating
    0
      0  

    Default ActionColumn 'getClass' is not getting the data passed in

    ExtJS, version 4.1.1.a
    ActionColumn > Ext.define.defaultRender
    Problem: argument passed into function (v) changed inside the function to html string.
    Original code:
    v = Ext.isFunction(me.origRenderer) ? me.origRenderer.apply(scope, arguments) || '' : '';
    ...
    v += '<img....
    ...
    return v;

    Should be changed to something like:
    var ret = Ext.isFunction(me.origRenderer) ? me.origRenderer.apply(scope, arguments) || '' : '';
    ...
    ret += '<img....
    ...
    return ret;

  2. #2
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,050
    Vote Rating
    1381
      0  

    Default

    Just creating a new variable isn't going to change the function of the defaultRenderer. The v variable isn't used in the method other than what the ret variable would be. Show me a test case that would produce unwanted behavior.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  3. #3
    Sencha Premium Member
    Join Date
    Apr 2012
    Posts
    3
    Vote Rating
    0
      0  

    Default

    Browser: Google Chrome 24.0.1312.52 m

    Best practice aside, this problem did cause problem in the "getClass" callback.

    Using "v" to build HTML changed "arguments", thus changed the parameters passed to "getClass". In my case, the "v" passed to getClass is always empty string, instead of the expected "The value of the column's configured field". After my changes, getClass behaves as expected. Check the highlighted part below if I was not clear.

    v += '<img alt="' + (item.altText || me.altText) + '" src="' + (item.icon || Ext.BLANK_IMAGE_URL) +
    '" class="' + prefix + 'action-col-icon ' + prefix + 'action-col-' + String(i) + ' ' + (item.disabled ? prefix + 'item-disabled' : ' ') +
    ' ' + (Ext.isFunction(item.getClass) ? item.getClass.apply(item.scope || scope, arguments) : (item.iconCls || me.iconCls || '')) + '"' +
    ((item.tooltip) ? ' data-qtip="' + item.tooltip + '"' : '') + ' />';

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •