如何访问对象属性 [英] How to acces Object property

查看:63
本文介绍了如何访问对象属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have external API, proxy is rest, reader defined, type: 'json', rootProperty: 'data;

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

How to get property "FullName" I have tried with record.get('FullName').

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

Created function called getDetails, passed as argument string, returned return record.get('FullName), always undefined.

 Details: function(v, record) {

       return record.get('FullName') 
    }

这是onDelete函数:

Here is onDelete function :

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();

            }
        })
    },

这是控制台登录记录的外观. 我有3个构造函数,分别带有Id的数据和obj属性)

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

推荐答案

您应使用record.get('FullName'),例如:

You should use record.get('FullName') like:

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

Your example on fiddle: https://fiddle.sencha.com/#view/editor&fiddle/2ttb

这篇关于如何访问对象属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆