How to acces Object property

梦想的初衷 提交于 2019-12-11 17:28:44

问题


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

How to get property "FullName" I have tried with 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') 
    }

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

            }
        })
    },

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


回答1:


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

            }
        })
    }

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



来源:https://stackoverflow.com/questions/57083847/how-to-acces-object-property

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!