1. #21
    Ext User
    Join Date
    Jan 2008
    Posts
    32
    Vote Rating
    0
    iwtrading is on a distinguished road

      0  

    Default


    Quote Originally Posted by iwtrading View Post
    Is this a possible solution?
    Code:
        queueChange:function(name, value) {
            var changed = undefined === this.state[name] || this.state[name] !== value;
            var o = {};
            if(changed) {
                o[this.paramNames.name] = name;
                o[this.paramNames.value] = this.encodeValue(value);
                var found = false;
                for (var ii=0; ii<this.queue.length-1; ii++) {
                    if (this.queue[ii].name == o.name) {
                        this.queue[ii] = o;
                        found = true;
                    }
                }
                if (!found) {
                    this.queue.push(o);
                }
                this.dirty = true;
            }
            return changed;
        },
    Bugfix:
    Code:
    ...
                for (var ii=0; ii<this.queue.length; ii++) {
                    if (this.queue[ii][this.paramNames.name] == o[this.paramNames.name]) {
                        this.queue[ii] = o;
                        found = true;
                    }
                }
    ...

  2. #22
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,527
    Vote Rating
    379
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    Yes, thank you for debugging. Grab the new code from the first post.

    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid Search Plugin, ExtJS 5 Complex Data Binding using MVVM


  3. #23
    Ext User
    Join Date
    Jan 2008
    Posts
    32
    Vote Rating
    0
    iwtrading is on a distinguished road

      0  

    Default


    Another change, in onReadSuccess:

    Bugfix

    orig:
    Code:
                if(!(data instanceof Array) && true === this.logFailure) {
                    this.log(this.dataErrorText, data, response);
                    return;
                }
    patch:
    Code:
                if (data == null || !(data instanceof Array)) {
                    if (true === this.logFailure) {
                        this.log(this.dataErrorText, data, response);
                    }
                    return;
                }
    and in queueChange:

    orig:
    Code:
    var changed = undefined === this.state[name] || this.state[name] !== value;
    my version:
    Code:
    var changed = undefined === this.queue[name] || this.queue[name] !== value;

    What do you think about?

  4. #24
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,527
    Vote Rating
    379
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    Quote Originally Posted by iwtrading View Post
    Another change, in onReadSuccess:

    Bugfix

    orig:
    Code:
                if(!(data instanceof Array) && true === this.logFailure) {
                    this.log(this.dataErrorText, data, response);
                    return;
                }
    patch:
    Code:
                if (data == null || !(data instanceof Array)) {
                    if (true === this.logFailure) {
                        this.log(this.dataErrorText, data, response);
                    }
                    return;
                }
    The test you propose is redundant as if data === null (btw, always use three = when testing for null) data is not instance of array.
    and in queueChange:

    orig:
    Code:
    var changed = undefined === this.state[name] || this.state[name] !== value;
    my version:
    Code:
    var changed = undefined === this.queue[name] || this.queue[name] !== value;
    What do you think about?
    No, you have to test if state changed, not queue. Queue is very fragile thing, it's cleared always on successful server save. Purpose of this test is not to save state item that hasn't changed.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid Search Plugin, ExtJS 5 Complex Data Binding using MVVM


  5. #25
    Ext User
    Join Date
    Jan 2008
    Posts
    32
    Vote Rating
    0
    iwtrading is on a distinguished road

      0  

    Default


    I have some problems, sometimes I lose any values.

    scenario:
    [desktop example]
    - drag and drop windows
    - save to server with HttpProvider saveSubmit
    - page refresh
    - windows are in correct position
    - I don't change anything
    - save to server with HttpProvider saveSubmit
    - page refresh
    - error: I lose the windows position information

    It perhaps misses the passage from state to queue.
    The queue is empty and override the state value.
    What do you think?

  6. #26
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,527
    Vote Rating
    379
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    Do you explicitly call submitState()? If yes you shouldn't.

    I'm using the same code as is in the first post and I never lost any state of anything whatsoever. Doesn't it get lost serverside?
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid Search Plugin, ExtJS 5 Complex Data Binding using MVVM


  7. #27
    Ext User
    Join Date
    Jan 2008
    Posts
    32
    Vote Rating
    0
    iwtrading is on a distinguished road

      0  

    Default


    Quote Originally Posted by jsakalos View Post
    Doesn't it get lost serverside?
    yes, you are right.


    Quote Originally Posted by jsakalos View Post
    Do you explicitly call submitState()? If yes you shouldn't.
    Yes, I call submitState(), because I want to save the state only when I leave the application.
    Are there possible problems doing in this way?

  8. #28
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,527
    Vote Rating
    379
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    Well, if you found the problem: "state lost serverside", and the above mentioned call does work, in that case I do not see any problem. Just set timeout high enough and call submitState on exit...
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid Search Plugin, ExtJS 5 Complex Data Binding using MVVM


  9. #29
    Ext User
    Join Date
    Jan 2008
    Posts
    32
    Vote Rating
    0
    iwtrading is on a distinguished road

      0  

    Default


    Thank you Jozef,

    I have another problem:
    when the event 'onunload' fires I call this:
    Ext.state.Manager.getProvider().submitState();

    It's work fine, but with IExplorer I have this error (example):
    The instruction at "0x0000000000000" referenced memory at "0x0000000000000". The memory could not be "read".
    Last edited by iwtrading; 26 Feb 2008 at 12:30 AM. Reason: fix

  10. #30
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,527
    Vote Rating
    379
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    Unfortunately, I have no idea. First, I do not use Micro$oft products and second, I've never used HttpProvider in this setup. BTW, onbeforeunload event is one of the most painful spots if you want a cross-browser application. I was replying to one thread recently where one user wanted to implement it and failed. You can try to search forums for onbeforeunload keyword.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid Search Plugin, ExtJS 5 Complex Data Binding using MVVM