Extjs 5 store.load()

时间:2015-08-27 12:32:28

标签: javascript extjs store extjs5

我有一个简单的(user_data)商店。我加载这个商店:

user_data_store.load({
    scope: this,
    callback: function(g, records, operation, success) {
         console.log(g);
         var login_name = ???
    },
});

这是一个简单的json:

[{
   "login_id" : "1",
   "login_name" : "test",
   "login_email" : "test@test.com",
   "login_mobile" : "11111111"
 }]

但我不知道如何获取login_name? (测试)

2 个答案:

答案 0 :(得分:1)

试试这种方式

user_data_store.load({
       scope: this,
       callback: function(records, operation, success) {
           console.log(records[0].get('login_name'));
       },
});

答案 1 :(得分:0)

试试这个

store.load({
    scope: this,
    callback: function(records, operation, success) {
        // the operation object
        // contains all of the details of the load operation
        console.log(records[0].login_name);
    }
});

参考docs