Extjs 5 store.load()

Extjs 5 store.load()

我有一个简单的 (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? (测试)

试试这个

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

试试这个方法

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