[CLOSED] Tasks stop running after store.save() is called

  1. #1

    [CLOSED] Tasks stop running after store.save() is called

    Hi,

    I'm having a strange problem when using a task manager.

    I'm trying to essentially poll, say every 5 mins, and check if a text editor control has been changed; if it has, I'm updating a store with the changed text content and then triggering the stores .save() method (which uses an UpdateProxy).

    The problem is that after I've triggered the .save() (which is all fine, it saves) the tasks seem to stop running. They're not autoRun tasks, I trigger them when I load the related store (the one I'm saving later on).

    Are TaskManager tasks meant to stop after a DirectEvent or something like that?

        <ext:TaskManager runat="server" ID="taskDraftSaver">
            <Tasks>
                <ext:Task TaskID="taskDrafts" Interval="10000" AutoRun="false">
                    <Listeners>
                        <Update Fn="syncStoreWithEditor" />
                    </Listeners>
                </ext:Task>
            </Tasks>
        </ext:TaskManager>
    syncStoreWithEditor:
    var syncStoreWithEditor = function (taskRunCount) {
        if (typeof pnlDocumentEditor_IFrame != "undefined" || taskDraftSaver.task[0].executing) {
            var editor = pnlDocumentEditor_IFrame.eong;
            if (storeClientReportDocuments.getCount() > 0 && (typeof editor != "undefined")) {
                if (editor.hasContentChanged()) {
                    var record = storeClientReportDocuments.getById(cboReportList.getSelectedItem().value);
                    record.set(cboReportView.getSelectedItem().text.split(' ').join(''), editor.getBodyFragment());
                    var s = storeClientReportDocuments.save();
                }
            }
        }
        return true;
    }
    .. on the UpdateProxy Save handler, I'm calling
    taskDraftSaver.startAll()
    . This doesn't appear to actually be starting the polling again, though.

    Cheers,
    Peter
    Last edited by Daniil; Oct 17, 2011 at 9:02 AM. Reason: [CLOSED]
  2. #2
    Hi,

    Quote Originally Posted by peter.campbell View Post
    .. on the UpdateProxy Save handler, I'm calling
    taskDraftSaver.startAll()
    . This doesn't appear to actually be starting the polling again, though.
    Please clarify where? I just don't know about UpdateProxy's Save listener.

    Did you mean Store's Save listener?

    Also I'm not sure why do you need to start a task again? Where do you stop it?
  3. #3
    Quote Originally Posted by Daniil View Post
    Hi,



    Please clarify where? I just don't know about UpdateProxy's Save listener.

    Did you mean Store's Save listener?

    Also I'm not sure why do you need to start a task again? Where do you stop it?
    Sorry. I did mean the Stores save listener:

    <ext:Store ID="storeClientReportDocuments" runat="server" AutoLoad="false">
            <Listeners>
                <Load Handler="Ext.Msg.hide();taskDraftSaver.startAll();" />
                <Save Handler="lblEditoStatus.setText('Saved @ ' + new Date().toString());" />
            </Listeners>
    Sorry. I wasn't clear: I'm trying to restart as it no longer fires. The javascript function syncStoreWithEditor is no longer called.
  4. #4
    Thanks for the details.

    Well, a task should not bee stopped.

    Could you provide a full, but simplified, sample to reproduce?
  5. #5
    I guess that 'syncStoreWithEditor' raises javascript exception
    Is it true?
  6. #6
    I should say also that there is no "task" property of TaskManager.
    taskDraftSaver.task[0].executing
    There is the "tasks" one.

    So, it can causes a JavaScript error.
  7. #7
    Sorry I got caught up in other work; do you still want me to create an example? Admittedly I've not tested this outside of my project yet.
  8. #8
    If the problem persists, then sure, we need a sample to help.

Similar Threads

  1. Store OnLoad called on every postback
    By wexman in forum 1.x Help
    Replies: 1
    Last Post: Nov 17, 2011, 11:53 AM
  2. [CLOSED] Store: How to stop Store.Each loop?
    By nhg_itd in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Nov 15, 2011, 5:27 AM
  3. IE Error : Stop running this script?
    By pooja in forum 1.x Help
    Replies: 5
    Last Post: Nov 07, 2011, 7:22 AM
  4. [CLOSED] Store.reload() not being called in user control
    By IT1333 in forum 1.x Legacy Premium Help
    Replies: 12
    Last Post: Jun 14, 2011, 9:02 PM
  5. [CLOSED] Error:Stop running this script
    By pbsoft in forum 1.x Help
    Replies: 2
    Last Post: Aug 05, 2010, 3:30 PM

Tags for this Thread

Posting Permissions