Alpha DevCon 2018
Results 1 to 11 of 11

Thread: delete local storage

  1. #1
    Member
    Real Name
    John Haytko
    Join Date
    Dec 2007
    Posts
    94

    Default delete local storage

    I have a simple component with a list and detail view. This is implemented as a Phonegap app with offline storage. We don't want the users to edit the list items or even see them after the new records are synchronized. So I am trying to delete the list local storage after the sync.

    I'm calling this in the client side afterSynchronizeList event in the list control detail view system events. Here is the javascript function:

    Function lsclear() {
    if (dialog.list.SPECIFY_LIST_NAME.isDirty = false)
    var obj = {dialog.object}._ls_getData(lists:t);
    {dialog.object}._ls_deleteKeys(obj);
    }

    I'm unable to get this to work. Perhaps I'm not implementing it properly. Please criticize

  2. #2
    "Certified" Alphaholic
    Real Name
    Chris Tappan
    Join Date
    Jun 2009
    Location
    Knoxville, TN
    Posts
    1,254

    Default Re: delete local storage

    One thought without my development computer in front of me--if the rest of that code would work you need correct Javascript structure and syntax.
    function lsclear() {
    if (dialog.list.SPECIFY_LIST_NAME.isDirty==false) {
    var obj = {dialog.object}._ls_getData(lists:t);
    {dialog.object}._ls_deleteKeys(obj);}
    }

  3. #3
    Member
    Real Name
    John Haytko
    Join Date
    Dec 2007
    Posts
    94

    Default Re: delete local storage

    Chris,
    Thank you for the comment. Are you saying the javascript isn't correct? I have a couple of other functions that are written very similarly that do work without the additional curly brackets. I was wondering because I'm unsure; if the event "afterSynchronizeList" is the correct or best place to call this function. Also wondering if I need to force a loose focus of the list records before calling it.

  4. #4
    "Certified" Alphaholic
    Real Name
    Govindan Gandhi
    Join Date
    Aug 2008
    Location
    New York, NY
    Posts
    4,294

    Default Re: delete local storage

    if (dialog.list.SPECIFY_LIST_NAME.isDirty = false)
    please see chris' code, what you have is assignment, what needs is validation.(needs ==)
    and you need the {} after the verification.
    thanks for reading

    gandhi

    version 11 3381 - 4096
    mysql backend
    http://www.alphawebprogramming.blogspot.com
    ggandhi344@gmail.com
    Skype:ggandhi344@gmail.com
    1 914 924 5171

  5. #5
    Member
    Real Name
    John Haytko
    Join Date
    Dec 2007
    Posts
    94

    Default Re: delete local storage

    Thank you for chiming in. This (dialog.list.SPECIFY_LIST_NAME.isDirty = false) is used in the enable expressions for buttons. According to the Building Disconnected Applications document. I'll give it a try. I guess my javascript needs work.

  6. #6
    "Certified" Alphaholic
    Real Name
    Chris Tappan
    Join Date
    Jun 2009
    Location
    Knoxville, TN
    Posts
    1,254

    Default Re: delete local storage

    I think in attempts to be easier alphas confused a number of people, but the show/hide expressions are not written in true JavaScript so your example can't be reused in actual JavaScript. I don't have it in front of me but I wouldn't count on the dirty property syntax or method to be the same either.

  7. #7
    "Certified" Alphaholic
    Real Name
    Govindan Gandhi
    Join Date
    Aug 2008
    Location
    New York, NY
    Posts
    4,294

    Default Re: delete local storage

    Quote Originally Posted by jhaytko View Post
    Thank you for chiming in. This (dialog.list.SPECIFY_LIST_NAME.isDirty = false) is used in the enable expressions for buttons. According to the Building Disconnected Applications document. I'll give it a try. I guess my javascript needs work.
    now it is more clear to me what you are trying to do. the property enable/disable for a button expression is what you have used to for activation of the rest of the javascript.
    as chris said those cannot be used in javascript. alpha converts them to real javascript when they compile the component to be used. since I am not in version 12 I won't know. there must be something that changed after synchronization. you should be able to tap into that and check and then act accordingly.

    if I have said too much, sorry for the intrusion.
    thanks for reading

    gandhi

    version 11 3381 - 4096
    mysql backend
    http://www.alphawebprogramming.blogspot.com
    ggandhi344@gmail.com
    Skype:ggandhi344@gmail.com
    1 914 924 5171

  8. #8
    Member
    Real Name
    John Haytko
    Join Date
    Dec 2007
    Posts
    94

    Default Re: delete local storage

    Thank you to Chris and Govindan,
    I'm obviously muddling my way through here but things are making sense now. I'll post if I get this working. Govindan you are not intruding but helping. Thank you for your valuable time.

  9. #9
    Member
    Real Name
    John Haytko
    Join Date
    Dec 2007
    Posts
    94

    Default Re: delete local storage

    If anyone was still interested I found the answer here: http://downloads.alphasoftware.com/A...DetailView.htm

    An absolute must read for anyone doing local storage. Many secrets are kept in this document!!!!

    Here is my revised function:

    function lsclear() {
    //delete local storage keys
    var obj = {dialog.object}._ls_getData('lists:t');
    {dialog.object}._ls_deleteKeys(obj);
    //this clears the detail view
    var lObj = {dialog.object}.getControl('TIC_LIST');
    lObj.newDetailViewRecord();
    }

  10. #10
    "Certified" Alphaholic
    Real Name
    Jetson Lilibeth
    Join Date
    Dec 2011
    Posts
    1,031

    Default Re: delete local storage

    Ho do I call or execute the above function in the client side afterSynchronizeList event in the list control ?

  11. #11
    Member
    Real Name
    John Haytko
    Join Date
    Dec 2007
    Posts
    94

    Default Re: delete local storage

    Did you download and read that document. So much is revealed within it that you are doing yourself a great disfavor if you don't. :)
    Force be with you.

Similar Threads

  1. Find client's local temp directory so web apps can save file to local machine
    By iviowa in forum Application Server Version 10 - Web/Browser Applications
    Replies: 5
    Last Post: 06-08-2010, 05:07 PM
  2. Files storage
    By Stan Mathews in forum Alpha Five Version 9 - Desktop Applications
    Replies: 4
    Last Post: 04-02-2009, 02:05 PM
  3. Password Storage
    By aschone in forum Code Archive
    Replies: 0
    Last Post: 03-14-2008, 04:48 PM
  4. Storage Size
    By Ron Bascom in forum Alpha Five Version 7
    Replies: 1
    Last Post: 11-01-2005, 05:37 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •