Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/multithreading/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Multithreading 在Sencha Touch应用程序中自动刷新列表_Multithreading_Sencha Touch_Refresh - Fatal编程技术网

Multithreading 在Sencha Touch应用程序中自动刷新列表

Multithreading 在Sencha Touch应用程序中自动刷新列表,multithreading,sencha-touch,refresh,Multithreading,Sencha Touch,Refresh,我正在开发一个简单的聊天应用程序,当我点击刷新按钮时,我可以查看更新的数据,但是当我的聊天被远程存储在数据库中时,我可以定期从服务器刷新数据吗 提前谢谢。您只需要定期调用刷新功能,对吗 所以你只需要添加一个setTimeoutrefresh,1000;在刷新函数的末尾。然后你只需要在应用程序启动时调用它 希望这对您有所帮助,您只需要定期调用刷新功能,对吗 所以你只需要添加一个setTimeoutrefresh,1000;在刷新函数的末尾。然后你只需要在应用程序启动时调用它 希望这有助于使用Sen

我正在开发一个简单的聊天应用程序,当我点击刷新按钮时,我可以查看更新的数据,但是当我的聊天被远程存储在数据库中时,我可以定期从服务器刷新数据吗


提前谢谢。

您只需要定期调用刷新功能,对吗

所以你只需要添加一个setTimeoutrefresh,1000;在刷新函数的末尾。然后你只需要在应用程序启动时调用它


希望这对您有所帮助,您只需要定期调用刷新功能,对吗

所以你只需要添加一个setTimeoutrefresh,1000;在刷新函数的末尾。然后你只需要在应用程序启动时调用它

希望这有助于使用Sencha Touch课程:

//create the delayed task instance with our callback
var task = Ext.create('Ext.util.DelayedTask', function() {
    //load the list's store here. The list will be automatically updated
    listComp.getStore().load();    // Assuming your list component is "listComp"
    listComp.refresh();    

    // The task will be called after each 10000 ms
    task.delay(10000);
}, this);

//The function will start after 0 milliseconds
//so we want to start instantly at first
task.delay(0);

//to stop the task, just call the cancel method
//task.cancel(); 
这应该适用于您的情况。

使用Sencha Touch的类别:

//create the delayed task instance with our callback
var task = Ext.create('Ext.util.DelayedTask', function() {
    //load the list's store here. The list will be automatically updated
    listComp.getStore().load();    // Assuming your list component is "listComp"
    listComp.refresh();    

    // The task will be called after each 10000 ms
    task.delay(10000);
}, this);

//The function will start after 0 milliseconds
//so we want to start instantly at first
task.delay(0);

//to stop the task, just call the cancel method
//task.cancel(); 

这应该适合您的情况。

也许您会对聊天应用程序中的套接字服务器连接感兴趣。每当服务器数据更改时,服务器将通知您的客户端。看看

也许您会对聊天应用程序中的套接字服务器连接感兴趣。每当服务器数据更改时,服务器将通知您的客户端。请看一下这个。 每次设置时,它都会调用该函数。 请看这个。 每次设置时,它都会调用该函数。

您好,让我将此添加到我的代码中,如果我需要任何进一步的帮助,我会回复给您。谢谢…您好,让我把这个添加到我的代码中,如果我需要任何进一步的帮助,我会回复给您。谢谢…谢谢。尝试了一下,在建议的代码片段中做了一些调整,我的工作得到了正确的执行。谢谢……我已经做了上面的例子。任务在主控制器中初始化,但切换到另一个视图后,运行的任务被取消。是否需要添加其他特定配置?Peter O。只有在您输入task时,任务才会取消。cancel;试着看看这里的例子。这对我来说是件好事。我想你也会的。谢谢。尝试了一下,在建议的代码片段中做了一些调整,我的工作得到了正确的执行。谢谢……我已经做了上面的例子。任务在主控制器中初始化,但切换到另一个视图后,运行的任务被取消。是否需要添加其他特定配置?Peter O。只有在您输入task时,任务才会取消。cancel;试着看看这里的例子。这对我来说是件好事。我想你也会的。