分机.js关联未及时完成加载

ext.js association not finished loading in time

本文关键字:加载 js 关联 分机      更新时间:2023-09-26

我在成本中心和站点模型之间建立了关联。

我的问题是,当我尝试在 CostCenterGrid 中显示站点时,关联没有及时加载。

 items: [
    {
        xtype: 'gridpanel',
        itemId: 'CostCenterGrid',
        columns: [
            {
                text: MR.locale.Name,
                dataIndex: 'Name',
                renderer: function(translation) {
                    return translation.get('ActualTranslation');
                },
                width: 150
            }, {
                text: MR.locale.Site,
                dataIndex: 'Site',
                renderer: function(value, meta, record) {
                    return record.getSite().get('ActualName');
                },
                width: 150
            },
        ],
        store: 'MR.store.administration.CostCenter',
    }

如您所见,我有一个用于站点属性的自定义渲染器。第一次渲染网格时,网站不显示。再次运行它时,该站点将正确显示。

如何克服这个问题?

通常,当您在第二次加载时出现此类异常时,它可能与异步进程有关。我认为您的记录对象一开始没有准备好或为空。请确保在呈现数据之前获取数据。