1. #1
    Sencha Premium Member
    Join Date
    Jan 2009
    Posts
    331
    Vote Rating
    57
    firefoxSafari is a jewel in the rough firefoxSafari is a jewel in the rough firefoxSafari is a jewel in the rough

      0  

    Default Local data store

    Local data store


    I'm a little unclear on exactly what the data stores in the Designer support.

    Is it possible to specify not only the definition but also the data that gets read in for data stores within the designer? Or perhaps point to a file on the local filesystem? Hitting a url is fine in many situations, but often for prototyping it seems that it would be more convenient to have a standard set of test data available locally (the services might not be written yet, server not available, etc).

  2. #2
    Ext JS Premium Member
    Join Date
    Mar 2010
    Posts
    3
    Vote Rating
    0
    acidblue is on a distinguished road

      0  

    Default


    I am not sure if the "file://" protocol works, but why not set up an apache webserver, or whatever (webrick, lighttpd, iis etc) you would like on your machine, that just points to your test data? For instance, I use OS X, so it's easy for developers to just use their "~/Sites" directory to store plain text files containing javascript/json test data. This way you still work via HTTP and it truly simulates what you are trying to do.

  3. #3
    Ext JS Premium Member
    Join Date
    Dec 2007
    Posts
    213
    Vote Rating
    0
    sanjshah is on a distinguished road

      0  

    Default


    I cannot get the stores to work,

    I have tried:
    1. Add Json Store
    2. Entered the url (I checked via typing in Firefox and can see the data) in this case I have used a Http location
    3. added the root

    right clicked on MyStore and Load Data:

    An Error has occured on line 7 in the designer-complete.js
    TypeError: Result of expression 'this.owner' [undefned] is not an object.

    Is this not the correct method?

    Thanks

  4. #4
    Ext JS Premium Member
    Join Date
    Mar 2010
    Posts
    3
    Vote Rating
    0
    acidblue is on a distinguished road

      0  

    Default


    I had the problem this morning. The url you enter is supposed to be relative to a base url. I found this (annoying) setting in the "Edit->Edit Preferences" menu. Here lies the "URL Prefix". Set your prefix ("http://localhost" or whatever) in this field, then your data store url is just something like "/somepath/to/a/json/result".

    I also noticed that the right click "Load Data" option is broken (throws an error). Select the datastore and click the "load data" button above.

    I am still trying to figure out how to get the grid to display the data. I believe I have it configured correctly, but no luck.

    Error messaging and reporting needs a lot of improvement. That annoying dialog that says something like "cannot load data with current configuration" is bad. A nice 404 with the darned URL it tried to hit would be nice. I would have noticed "http://localhosthttp://localhost/testdata.js" as being an issue.

  5. #5
    Ext JS Premium Member
    Join Date
    Dec 2007
    Posts
    213
    Vote Rating
    0
    sanjshah is on a distinguished road

      0  

    Default


    Thanks acid,

    I tried your suggestions but still cannot get this to works.

    You are correct it would be nice to show the url being used to load data when an error occurs, this would help.

    Regards

    Sanj


    Quote Originally Posted by acidblue View Post
    I had the problem this morning. The url you enter is supposed to be relative to a base url. I found this (annoying) setting in the "Edit->Edit Preferences" menu. Here lies the "URL Prefix". Set your prefix ("http://localhost" or whatever) in this field, then your data store url is just something like "/somepath/to/a/json/result".

    I also noticed that the right click "Load Data" option is broken (throws an error). Select the datastore and click the "load data" button above.

    I am still trying to figure out how to get the grid to display the data. I believe I have it configured correctly, but no luck.

    Error messaging and reporting needs a lot of improvement. That annoying dialog that says something like "cannot load data with current configuration" is bad. A nice 404 with the darned URL it tried to hit would be nice. I would have noticed "http://localhosthttp://localhost/testdata.js" as being an issue.

  6. #6
    Ext JS Premium Member
    Join Date
    Mar 2010
    Posts
    3
    Vote Rating
    0
    acidblue is on a distinguished road

      0  

    Default


    Just to make sure:
    Here is a quick json data example:

    {
    "Example": [
    {"id":1, "val":"1"},
    {"id":2, "val":"3"},
    {"id":3, "val":"1"},
    {"id":4, "val":"1"},
    {"id":5, "val":"1"}
    ]
    }



    Save that to a file named "example.js" and make it accessible within your http server.

    So, assuming you have it @ http://localhost/example.js

    Make sure your base url prefix (in the edit->edit preferences) is http://localhost/

    Create your datastore and set the following properties:

    root: Example
    storeId: Example //not required for our test, but...
    url: /example.js


    Then click on the load data button
    Does it work? Are you sure you have the correct url? Are you missing a path component such as http://localhost/<~your home dir>/path ?

    Other than that, I am not sure. I'm not having a lot of luck on this application. What OS are you using?

  7. #7
    Sencha User evallgar's Avatar
    Join Date
    Jun 2007
    Location
    Monterrey, MX
    Posts
    5
    Vote Rating
    0
    evallgar is on a distinguished road

      0  

    Default Getting it to work

    Getting it to work


    So far Im trying right now to replicate an already built app. At this moment everything is new and unknown ... Well ... mostly.

    The designer is doing a lot of weird things while working with it ... Im still supposing that these is due to the trial version (even it says its a fully working version )

    In regards to the store I have already made it to connect

    my edit preferences -> base url is: http://localhost/myAppName/

    In my stores im using: url: 'datastores/storename.php' where stores is the subfolder within myAppName.

    It works, it loads the data (at least thats what it says) but still cant see it with the preview (binded to a GridPanel)

    I will keep going with testing to see how well this new tool performs.

    Best of luck to each of us!!! We'll keep posting info as it becomes available.

    Regards,
    Ernesto Vallejo.
    Kind regards,
    Ernesto Vallejo.

  8. #8
    Ext JS Premium Member
    Join Date
    Dec 2007
    Posts
    213
    Vote Rating
    0
    sanjshah is on a distinguished road

      0  

    Default


    Acid,

    Thanks it works when I preview in a browser but cannot load the store in the Designer, at least we are getting somewhere.

    I must say I know its a bit buggy but the ExtJS guys have done a great job on the designer.

    Quote Originally Posted by acidblue View Post
    Just to make sure:
    Here is a quick json data example:

    {
    "Example": [
    {"id":1, "val":"1"},
    {"id":2, "val":"3"},
    {"id":3, "val":"1"},
    {"id":4, "val":"1"},
    {"id":5, "val":"1"}
    ]
    }



    Save that to a file named "example.js" and make it accessible within your http server.

    So, assuming you have it @ http://localhost/example.js

    Make sure your base url prefix (in the edit->edit preferences) is http://localhost/

    Create your datastore and set the following properties:

    root: Example
    storeId: Example //not required for our test, but...
    url: /example.js


    Then click on the load data button
    Does it work? Are you sure you have the correct url? Are you missing a path component such as http://localhost/<~your home dir>/path ?

    Other than that, I am not sure. I'm not having a lot of luck on this application. What OS are you using?

  9. #9
    Sencha Premium Member
    Join Date
    Jan 2009
    Posts
    331
    Vote Rating
    57
    firefoxSafari is a jewel in the rough firefoxSafari is a jewel in the rough firefoxSafari is a jewel in the rough

      0  

    Default


    Quote Originally Posted by acidblue View Post
    I am not sure if the "file://" protocol works, but why not set up an apache webserver, or whatever (webrick, lighttpd, iis etc) you would like on your machine, that just points to your test data? For instance, I use OS X, so it's easy for developers to just use their "~/Sites" directory to store plain text files containing javascript/json test data. This way you still work via HTTP and it truly simulates what you are trying to do.
    Sure, that makes sense I'm fine with setting something like that up. I'm just thinking ahead to when I recommend other people in my organization try it out. A business analyst type might not be as comfortable with this but could still be effective with the Designer... at the least I might have to help set it up on their machines.

    This works, but I'd still like to see more capabilities for dealing with data inside the Designer itself. Maybe a future version could come with an embedded server and give you the option of using that if you want.

  10. #10
    Sencha Premium Member
    Join Date
    Mar 2010
    Posts
    111
    Vote Rating
    -1
    predator has a little shameless behaviour in the past

      0  

    Default


    I managed to make it work and to display the data in the grid within the designer. However this works only the 1st time, example:

    I create new store and add the fields, then I click load and it shows me how many records are loaded. Then on the grid I am adding the corresponding dataIndex-es and the data appearing in the grid.

    However if I close the project and then reopen it to continue working... the attempt to load the store is failing and the line 7 error is appearing.

    adding new store and reconfiguring it again solve the problem but only until the next time you open the project.