如何访问对象属性

时间:2019-07-17 20:46:37

标签: extjs

我有外部API, 代理人休息了, 读者定义的 类型:“ json”, rootProperty:'数据;

如何获取属性“ FullName” 我已经尝试过record.get('FullName')。

创建的名为getDetails的函数,作为参数字符串传递,返回 返回record.get('FullName),始终未定义。

 Details: function(v, record) {

       return record.get('FullName') 
    }

这是onDelete函数:

OnDelete: function (record,data) {
     Ext.Msg.confirm('Delete Changes', 'Do you want to delete' + " " + record.Details, function (choice) {

            if (choice === 'yes') {
                var store = Ext.getStore('store.Personnel');
                store.remove(record);
                store.sync();

            }
        })
    },

this is how console log on record look like. I have 3 constructors with Id's then data, and then obj properties

1 个答案:

答案 0 :(得分:0)

您应使用record.get('FullName')之类的

OnDelete: function (grid, rowId) {
    var record = grid.getStore().getAt(rowId);
        Ext.Msg.confirm('Delete Changes', 'Do you want to delete' + " " + record.get('FullName'), function (choice) {
            if (choice === 'yes') {
                var store = grid.getStore();
                console.log(store)
                store.remove(record);

            }
        })
    }

您的小提琴示例:https://fiddle.sencha.com/#view/editor&fiddle/2ttb