1. #1
    Sencha Premium Member
    Join Date
    Oct 2008
    Posts
    26
    Vote Rating
    1
    WeeJavaDude is on a distinguished road

      0  

    Default Is there a way to do a direct Store without returning a list

    Is there a way to do a direct Store without returning a list


    I am using extdrirectspring and I have a call that returns a structure and in it is the a couple of lists that I will be breaking down into stores. Looking at documentation it appears that ExtDirect to store only supports list.

    If this is the case, what is the best practice here. Do I create a list of one item or should I create a Class that fires a direct call and then adds the results to the Store.

    Thanks in Advance for your thoughts.

  2. #2
    Sencha Premium Member
    Join Date
    Oct 2008
    Posts
    26
    Vote Rating
    1
    WeeJavaDude is on a distinguished road

      0  

    Default


    Dug a bit more and still am confused. I see a lot of examples doing a JSON call and then being able to pick a list out of that JSON call. In regards to a ExtDirect and a Store there seems to be this assumption that a list will always come back and in the real world you get things like.

    Structure with a list and possible some status information.
    Structure with multiple list that you want to put into multiple stores.

    What am I missing here? Really want to encapsulate my data calls into Stores but using ExtDirect with Stores seems rather limited and I am starting to think I might need to have a helper class type system, make a direct call, and then on the Client side extract the data and fill the store.

    Really could use some help here.

  3. #3
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,522
    Vote Rating
    814
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    So you want to return multiple arrays for different stores? I don't really follow.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  4. #4
    Sencha Premium Member
    Join Date
    Oct 2008
    Posts
    26
    Vote Rating
    1
    WeeJavaDude is on a distinguished road

      0  

    Default Not multiple Stores

    Not multiple Stores


    Problem is this and perhaps it is around very poor documentation on Ext-Direct. I have Store that is going to make a Direct call. That call is not returning a list. It is returning a structure that has two lists in it plus some other fields. I want to place those two lists into Stores and at the same time read a status for success or failure. From the quick read of the docs and examples (Not a lot there), I got the impression I can only return a list. The other things that seem to be missing are.

    1) What happens if an Java Exception occurs.
    2) There is a success field that is part of the return values. When is it true and if it is false how do I get more info on why it is false.

    Hopefully this clarifies what I am asking. I saw examples of how to create two stores from a single call but it was not down in a Store if I recall. I am currently creating an basic object and doing it there but it would be really nice if I could encapsulate it all into a store.

    Is there any really good Ext-Direct Store examples and documenation?

  5. #5
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,522
    Vote Rating
    814
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    You can do this 3 ways:

    1) One of the great things about using Direct is it can batch requests into a single Ajax request. This means if you have 2 stores loading within a threshold it will actually do a single request to load both stores.

    2) Use hasMany associations which will create 2 stores for the one record in the "main" store.

    3) Execute the direct api directly and handle the data in the response.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  6. #6
    Sencha Premium Member
    Join Date
    Oct 2008
    Posts
    26
    Vote Rating
    1
    WeeJavaDude is on a distinguished road

      0  

    Default


    I think I might not be describing this properly.

    1) I am sending a single request that returns a structure. The structure has two arrays in it that I want to fill the Store with. I am not sending multiple requests.

    2) We are using ExtDirectSpring. The documentation I am looking at is at https://github.com/ralscha/extdirect...re-Read-Method. Since they are implementing the Ext-direct spec I am looking at the API and it seems to not handle a structure well.

    3) Right now I am creating a specific class with the purpose making a ExtDirect call and then manually push the data into the stores. Trying to avoid it but I am starting to think this is not possible.

    4) Normally in a client to server communication you have two type of errors. One is an Exception thrown by the server for abnormal conditions. The other might be a status code. From what I can tell with the Store implementation (From reading) both of these are not handled well. I read something about turning the router in debug mode to handle exceptions which of course is not what I want to do. So back to the question.. With Stores, how do I handle exceptions from the server and how do handle returning some status meta data.

    Am I missing something? Still confused. Can you elaborate more on your #3 suggestion.

Thread Participants: 1