1. #1
    Ext User angsuman's Avatar
    Join Date
    Jul 2007
    Location
    Kolkata, India
    Posts
    6
    Vote Rating
    0
    angsuman is on a distinguished road

      0  

    Lightbulb Loading ComboBox.store manually fails in local mode - Ext 1.1

    Loading ComboBox.store manually fails in local mode - Ext 1.1


    Use cases
    Let's first look at the use cases which I am sure many will agree with.

    1. I want to load a ComboBox on demand. I have very large number of columns in a grid, each of which has a ComboBox to help selecting a value. I don't want to load all the data upfront as that slows down the initial loading. So I want to load the data when the ComBox drop-down is clicked. I can easily do that in remote mode but the downside is that the filtering functionality asks the server for filtering. The data I fetched is fixed and it is already on the client, so there is no justification for bothering the server.


    2. An alternative scenario is when you have a dynamically loaded ComBox. You would still like to do local filtering, when the data has been fully loaded, for better performance. This might be the one you can better associate with.

    Defect
    My solution was to keep the ComboBox in local mode but load the store on first access. This works perfectly in remote mode for the dynamically loading case. However it doesn't work when the mode is local. In local mode the doQuery() calls clearFilter() which replaces the new data in the store with old stale snapshot data.

    What is needed is to replace the snapshot data in this case with the current data in the store after a successful reload.

    The real defect is that in this case clearFilter() shouldn't replace the store with old snapshot when the store has been refreshed by a call to load.

    Solution
    My solution was to create a method for this in ComboBox:
    Code:
    Ext.data.Store.prototype.updateSnapshot = function() {
        this.snapshot = this.data
    }
    And then call this method after loading the ComboBox.

    The solution works but I am not fully happy as it isn't elegant. Looking forward to hear a better idea in solving this problem.

    Additional Thoughts
    I think there should be a way for clearFilter() to recognize when new data has been loaded versus when filtered data has been loaded for the old data. Both cases uses load().
    The solution could be a new configuration parameter to load() which clearFilter() looks for and processes, if available.

    What do you think?
    Last edited by angsuman; 20 Aug 2007 at 7:44 AM. Reason: Added version
    Angsuman Chaktaborty
    Simple solutions for complex problems
    Taragana
    Java & Web Tech Blog

  2. #2
    Sencha - Community Support Team mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236
    Vote Rating
    5
    mystix will become famous soon enough

      0  

    Default


    firstly, what are you loading 180+ columns of information for?
    (just curious, as i've yet to come across a use case for this.)

    secondly, maybe i'm missing something, but why is this a bug?

    p.s. just checking, but have you read this?

  3. #3
    Ext User angsuman's Avatar
    Join Date
    Jul 2007
    Location
    Kolkata, India
    Posts
    6
    Vote Rating
    0
    angsuman is on a distinguished road

      0  

    Default


    > firstly, what are you loading 180+ columns of information for?
    (just curious, as i've yet to come across a use case for this.)

    Client wants all the data displayed and editable. Frankly for the business domain there isn't an alternative solution that I could think of.

    > secondly, maybe i'm missing something, but why is this a bug?

    This is a bug because in local mode we are unable to load the store and have the data displayed. When the underlying store is loaded / refreshed, that is the data that should be used and not the old stale data stored in snapshot cache. This is an artifact of clearFilter which is incorrect. clearFilter should not replace with the old snapshot when the data has been refreshed.



    > p.s. just checking, but have you read this?[/quote]
    Yes.
    Angsuman Chaktaborty
    Simple solutions for complex problems
    Taragana
    Java & Web Tech Blog

  4. #4
    Sencha - Community Support Team mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236
    Vote Rating
    5
    mystix will become famous soon enough

      0  

    Default


    Quote Originally Posted by angsuman View Post
    > p.s. just checking, but have you read this?
    Yes.
    and you're reporting this for Ext 1.___?

  5. #5
    Ext User angsuman's Avatar
    Join Date
    Jul 2007
    Location
    Kolkata, India
    Posts
    6
    Vote Rating
    0
    angsuman is on a distinguished road

      0  

    Default


    Quote Originally Posted by mystix View Post
    and you're reporting this for Ext 1.___?
    Updated. Ext 1.1 and 1.1 betas too. This is pretty universal so i didn't think of reporting the version.
    Angsuman Chaktaborty
    Simple solutions for complex problems
    Taragana
    Java & Web Tech Blog

  6. #6
    Ext User angsuman's Avatar
    Join Date
    Jul 2007
    Location
    Kolkata, India
    Posts
    6
    Vote Rating
    0
    angsuman is on a distinguished road

      0  

    Default


    I added more description and clarifications. Hopefully this also simplifies the description.
    Angsuman Chaktaborty
    Simple solutions for complex problems
    Taragana
    Java & Web Tech Blog

Thread Participants: 1