Подача данных из JsonStore - PullRequest
       16

Подача данных из JsonStore

0 голосов
/ 09 июня 2019

Подача данных просмотра из jsonstore

Я хочу использовать JsonStore для подачи моего просмотра данных.в настоящее время с кодом ниже, магазин пуст в окне просмотра данных.Для тестирования я написал некоторый код в контроллере перед тем, как открыть окно, и я вижу, что служба restful получает данные - getActivitiesToRescueCallback --> responce.responseText.Как я могу скормить мой просмотр данных с помощью Jsonstore?

В этом ViewController:

getActivitiesToRescueCallback : function(options, success, response) {
    if (success)
        var result = Ext.decode(response.responseText); // Here I am getting data

},

getActivitiesToRescue : function() {
    Ext.Ajax.request({
        url : '/test/json_p',
        params : {
            "params[]" : "RESCUE",
            "respName" : "",
            "method" : "GetActivities",
            "format" : "json"
        },
        callback : 'getActivitiesToRescueCallback',
        scope : this
    });
},
**View**
Ext.define('Tuv.test.rescue.RescueView', {

extend : 'Ext.window.Window',

alias : 'widget.rescueview',

alias : 'controller.rescueview',

bind : {
    title : '{rescueTexts.masseRescue}'
},

height : 400,

width : 600,

constrainHeader : true,

maximizable : true,

closeAction : "hide",

layout : 'card',

activeItem : 0,

items : [ {
    xtype : 'panel',
    title : 'check activities',
    layout : 'hbox',
    border : false,
    layoutConfig : {
        align : 'stretch'
    },
    tbar : [ {
        xtype : "button",
        text : "copy",
        handler : function() {},
        scope : this
    } ],
    items : [ {
        autoScroll : true,
        width : 150,
        items : {
            xtype : 'dataview',
            listeners : {
                'afterrender' : function(comp) {
                    console.log('Test');
                },
                scope : this
            },
            store : new Ext.data.JsonStore({
                url : '/test/json_p',
                baseParams : {
                    "params[]" : "RESCUE",
                    respName : "",
                    method : "GetActivities",
                    format : "json"
                },
                idProperty : 'ACT_ID',
                fields : [ 'ACT_ID', '_ACT_TYPE', '_FIRST_FORM', 'PRUEFSTATUS', '_DEBUG', '_SYNC_STATUS', '_SYNC_STATUS2', 'EQART', 'INVNR', 'ZTSPRID', 'ANLAGE_ZTSPRID', 'ZTSPRIDT' ]
            }),
            itemSelector : 'tr.dataRow',
            tpl : new Ext.XTemplate('<table id="dataRescueTable">' + '<tpl for=".">', '<tr class="dataRow"><td>' + '<span <tpl if="STATUS==50">style="font-weight: bold;color:green"</tpl>>{name}</span></td></tr>', '</tpl>', '</table>')
        }
    } ],
    bbar : {
        buttonAlign : 'right',
        items : [ {
            text : "next",
            handler : function(button) {

            },
            scope : this
        } ]
    }
} ]

});

1 Ответ

0 голосов
/ 11 июня 2019

Чтобы загрузить магазин, мне пришлось позвонить store.load() или добавить autoLoad: true в качестве конфигурации в магазин.

...