1. #1
    Sencha User xereta's Avatar
    Join Date
    Jul 2012
    Location
    Brazil
    Posts
    23
    Vote Rating
    0
    xereta is on a distinguished road

      0  

    Default Answered: NestedList and TreeStore 2mb local file

    Answered: NestedList and TreeStore 2mb local file


    Hello,

    I am current having a problem with the size of the TreeStore's data.
    I am doing an App, that needs to show a tree in a NestedList.
    This data needs be show offline, so i built a json file and put it on "resources/data" folder.
    However, this has became a 2.5mb file, and the NestedList has became slowly to navigate in it.

    I can't think on an other way to do it.

    I have already thought in use a List in the place of NestedList, and then create different files to the children, but it seens a big workaround to me.

    Any of you could give me an idea?

  2. I'm not sure if NestedList will work; you may need to intervene programmatically a little more with this proxy, creating stores on the go with a remoteFilter set to the relevant parent ID.

    I'd start with a simple list example and go from there.

    I would populate the websql if it hasn't already been populated at the start of the application, yes.

    The main advantage to you is the remoteFilter/sort configs will operate on the database, so javascript won't have to hold the data in memory, and you can bring subsets of the data into javascript memory as you need to display them.

  3. #2
    Sencha User
    Join Date
    Jan 2012
    Location
    London, UK
    Posts
    482
    Answers
    24
    Vote Rating
    48
    shepsii has a spectacular aura about shepsii has a spectacular aura about shepsii has a spectacular aura about

      1  

    Default


    You're going to have issues just on the data being stored in memory alone, nevermind the DOM, IMO.

    My workaround is to read the JSON files as raw data myself, take what I want out of the data structure, remove the rest from memory and then work with the subset I want in a sencha touch store. Easier said than done... it requires lots of fiddly code.
    I blog about Sencha Touch at www.senchatouchdev.com

  4. #3
    Sencha User xereta's Avatar
    Join Date
    Jul 2012
    Location
    Brazil
    Posts
    23
    Vote Rating
    0
    xereta is on a distinguished road

      0  

    Default


    Quote Originally Posted by shepsii View Post
    My workaround is to read the JSON files as raw data myself, take what I want out of the data structure, remove the rest from memory and then work with the subset I want in a sencha touch store. Easier said than done... it requires lots of fiddly code.
    In the truth i don't like this idea. But I didn't find any othe way until now. =s
    Do you have some code's example for it?

    Or someone else has anyother idea?

  5. #4
    Sencha User
    Join Date
    Jan 2012
    Location
    London, UK
    Posts
    482
    Answers
    24
    Vote Rating
    48
    shepsii has a spectacular aura about shepsii has a spectacular aura about shepsii has a spectacular aura about

      0  

    Default


    I'll be posting some soon when it's cleaned up.

    The simple fact of the matter is that you cannot store 2.5mb of data in a sencha touch store without a significant hit to performance on some devices.

    I don't like having to do it either - at all - but until there's a better way to store data subsets in sencha touch, that's what has to happen.

    Either that, or store the data in a database and query it into stores as necessary using a sqlite proxy.
    I blog about Sencha Touch at www.senchatouchdev.com

  6. #5
    Sencha User xereta's Avatar
    Join Date
    Jul 2012
    Location
    Brazil
    Posts
    23
    Vote Rating
    0
    xereta is on a distinguished road

      0  

    Default


    And I have another problem too.
    It is required to filter the NestedList.
    But to filter a 2.5mb store is realy slow. =s

  7. #6
    Sencha User
    Join Date
    Jan 2012
    Location
    London, UK
    Posts
    482
    Answers
    24
    Vote Rating
    48
    shepsii has a spectacular aura about shepsii has a spectacular aura about shepsii has a spectacular aura about

      1  

    Default


    websql/sqlite would seem to be a good solution. As you could do your filtering via db queries.
    I blog about Sencha Touch at www.senchatouchdev.com

  8. #7
    Sencha User xereta's Avatar
    Join Date
    Jul 2012
    Location
    Brazil
    Posts
    23
    Vote Rating
    0
    xereta is on a distinguished road

      0  

    Default


    Quote Originally Posted by shepsii View Post
    websql/sqlite would seem to be a good solution. As you could do your filtering via db queries.
    Thanks, I will try to use WebSQL. Does it work on mobile, after build native?
    Does it work on iOS and Android?
    I have read that the websql works only in the webkit.
    I dont know if the default browser of Android is a webkit one (I know that it is not Chrome).

    How should I do to use a Webkit? To create the database on the app's initialize? Read the json file and than populate the database?
    I didn't know that it is possible to access database files from javascript.
    Maybe this webSQL is not a file at all. It use the storage from HTML?

  9. #8
    Sencha User
    Join Date
    Jan 2012
    Location
    London, UK
    Posts
    482
    Answers
    24
    Vote Rating
    48
    shepsii has a spectacular aura about shepsii has a spectacular aura about shepsii has a spectacular aura about

      1  

    Default


    Yes, works fine after a native build. Just be careful about how you create the connection as this can lead to exceptions in the terminal when you build. If you create the connection on your first query, rather than launch, you are fine for sure.

    Works fine on iOS and Android. Native browsers for each (including Chrome in newer Android versions) are all webkit based.

    WebSql doesn't only work in webkit, it's an HTML5 implementation. I'm not certain how well other browsers support it. But for Android and iOS you're fine.

    Take a look at either the sqlite proxy in touch 2.1 on, or my sqlite proxy in the showcases forum. I haven't used sencha's implementation myself, nor mine for nearly a year now, but I know others continue to use it based on the thread! Happy to help there and hopefully others can chime in with some solutions where you need them too. The key is using the remoteFilter and remoteSort configs on your store.
    I blog about Sencha Touch at www.senchatouchdev.com

  10. #9
    Sencha User xereta's Avatar
    Join Date
    Jul 2012
    Location
    Brazil
    Posts
    23
    Vote Rating
    0
    xereta is on a distinguished road

      0  

    Default


    Quote Originally Posted by shepsii View Post
    Take a look at either the sqlite proxy in touch 2.1 on, or my sqlite proxy in the showcases forum. I haven't used sencha's implementation myself, nor mine for nearly a year now, but I know others continue to use it based on the thread! Happy to help there and hopefully others can chime in with some solutions where you need them too. The key is using the remoteFilter and remoteSort configs on your store.
    Sorry, I didn't understand something. Should I use sqlite proxy to connect with the webSQL?
    I am trying to do a clean code.

  11. #10
    Sencha User
    Join Date
    Jan 2012
    Location
    London, UK
    Posts
    482
    Answers
    24
    Vote Rating
    48
    shepsii has a spectacular aura about shepsii has a spectacular aura about shepsii has a spectacular aura about

      1  

    Default


    All the sqlite proxies you will see will work just as well in websql as they do sqlite.

    websql is part of localstorage, so the 5mb limit applies. You get websql everywhere - webapps as well as native apps.

    The only way to get to a sqlite db from Sencha Touch is to package to native and use a phonegap plugin. You only need to do this if you want to use more than 5mb.

    Otherwise, just go ahead and use the "sqlite" proxies and know that they will work in websql too.
    I blog about Sencha Touch at www.senchatouchdev.com

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar