Results 1 to 2 of 2

Thread: Unable to call a function inline

  1. #1
    Sencha Premium User
    Join Date
    Aug 2016
    Posts
    30

    Default Answered: Unable to call a function inline

    I'm trying to define a function in my Class and then call it within the same class but it doesn't seem to be working.

    Ext.define('MyDemoApp.view.forum.Forum', {
    extend: 'Ext.grid.Panel',
    requires: [
    'MyDemoApp.store.ForumStore',
    ],

    store: {
    type: 'forumStore'
    },

    renderTopic: function (value, p, record) {
    console.log(value);
    return Ext.String.format(
    "<a href='http://sencha.com/forum/showthread.php?t={2}' target='_blank'>{0}</a>",
    value,
    record.data.forumtitle,
    record.getId(),
    record.data.forumid
    );
    },

    alias: 'widget.forum-app',

    width: '100%',
    height: 500,
    collapsible: true,
    title: 'ExtJS.com - Browse Forum Threads',
    loadMask: true,
    selModel: {
    pruneRemoved: false
    },
    multiSelect: true,
    viewConfig: {
    trackOver: false,
    },
    features: [{
    ftype: 'grouping',
    hideGroupedHeader: false,
    }],
    plugins: 'gridfilters',

    columns:[{
    xtype: 'rownumberer',
    width: 50,
    sortable: false
    },{
    tdCls: 'x-grid-cell-topic',
    text: "Topic",
    dataIndex: 'title',
    flex: 1,
    renderer: this.renderTopic,
    sortable: true,
    groupable: false,
    cellWrap: true,
    filter: true
    },{
    text: "Author",
    dataIndex: 'username',
    width: 100,
    hidden: true,
    sortable: true,
    groupable: false
    },{
    text: "Replies",
    dataIndex: 'replycount',
    align: 'center',
    width: 70,
    sortable: false,
    filter: {
    type: 'numeric'
    }
    },{
    id: 'last',
    text: "Last Post",
    dataIndex: 'lastpost',
    width: 130,
    renderer: Ext.util.Format.dateRenderer('n/j/Y g:i A'),
    sortable: true,
    groupable: false
    }]


    });

    renderTopic doesn't seem to fire no matter what I try? Thoughts? What am I missing?

  2. When the class is defined, this.renderTopic is still undefined when the line "renderer: this.renderTopic" is reached.

    Either define the function outside of the class, or define the function inline, like “renderer: function () {...}", or use setRenderer in the initComponent method to set the renderer after the class already exists.

  3. #2
    Sencha User
    Join Date
    Dec 2007
    Posts
    52
    Answers
    2

    Default

    When the class is defined, this.renderTopic is still undefined when the line "renderer: this.renderTopic" is reached.

    Either define the function outside of the class, or define the function inline, like “renderer: function () {...}", or use setRenderer in the initComponent method to set the renderer after the class already exists.

Similar Threads

  1. [CLOSED] Unable to use mixins inline
    By SebTardif in forum Ext 5: Bugs
    Replies: 1
    Last Post: 4 Aug 2014, 3:42 AM
  2. [OPEN] Unable to create inline treestore using alias
    By ypandey in forum Ext:Bugs
    Replies: 1
    Last Post: 28 Apr 2014, 5:13 PM
  3. Unable to call POP-UP image function from Html code
    By Padmaja09 in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 15 Feb 2012, 11:09 PM
  4. unable call a function from radio/checkbox
    By binny123 in forum Sencha Touch 1.x: Discussion
    Replies: 2
    Last Post: 29 Mar 2011, 1:07 AM
  5. Unable to call a function from a window's toolbar
    By orangehairedboy in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 27 Mar 2008, 11:27 AM

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
  •