How to update Extjs progress bar with JSON results?

I have come across some difficulties in getting my progress bar to get its progress from the Json results and update the progress bar based on a timer check every 10 seconds.

I can create a json result as follows:

{"success":true, "progress":0.2}

I believe the general idea is that I need a task with an interval set to 10sec and a runner to start the task, and when the progress bar starts to work, the runner checks the results from Json and update the progress bar as necessary.

Code so far:

var task = {
    run: function(){
        // what to add here?
    },
        interval: 10000
    }
}

Having said that, I have difficulties:

  • How to add a Json part to a task?
  • How to update a progress bar with a given Json result?

Many thanks.

+3
2

, , . , , .

, json- URL-, .

, :

Ext.Ajax.request({
           url: 'getStatus',
           success: function(r) {
                 var i = Ext.decode(r.responseText).progress;
                 progressbar.updateProgress(count +' completed');
           }
});
+5

, , .


Json ?

memcached - , , . , , , - .

, , , . , , n , .

, , , , .


Json?

ExtJS TaskManager, ajax- n .

// Start a simple clock task that updates a div once per second
var task = {
    run: function(){
        Ext.fly('clock').update(new Date().format('g:i:s A'));
    },
    interval: 1000 //1 second
}
Ext.TaskMgr.start(task);
0

Source: https://habr.com/ru/post/1723064/


All Articles