localstorage JSON array not displaying following upgrade

I have a couple of pages which are supposed to display data from a locally stored stringified JSON array. However, these pages no longer display the data and instead remain blank.

To recreate the problem, click News, then Search and either select a category from the drop down or enter 'rec' (for example) into the input and hit search.

I've had a good look but cannot work out what the issue is.

This is the app:
http://appery.io/app/view/25807b5d-c4...

It is share with support@appery.io.

Your help is appreciated. Thanks.
1 person has
this problem
+1
This topic is no longer open for comments or replies.
  • Hi Chris,

    Is your data saved to localStorage?
    In what variable the data is supposed to be stored?

    You can also check how to work with localStorage after upgrade:
    http://devcenter.appery.io/documentat...
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited kidding, amused, unsure, silly sad, anxious, confused, frustrated indifferent, undecided, unconcerned

  • The data is stored in localstorage as the variable 'json_news'.

    This is the javascript I'm using to filter the data:


    Appery.get_cache_news_filtered_js = Appery.createClass(null, {

    init: function (requestOptions) {
    this.__requestOptions = $.extend({}, requestOptions);
    },

    process: function (settings) {
    settings.beforeSend(settings);
    if (this.__requestOptions.echo) {
    settings.success(this.__requestOptions.echo);
    } else {

    var cdata = JSON.parse(Apperyio.storage.json_news.get());
    var category_slug = Apperyio.storage.category_slug.get();
    //alert(category_slug);

    var filter_data = [];
    jQuery.grep(cdata.posts, function (post, key) {
    var found = false;
    post.categories.forEach(function (category) {
    if (category.slug == category_slug) {
    found = true;
    }
    });
    if (found) {
    filter_data.push(post);
    }
    });
    cdata.posts = filter_data;

    var cdata_filtered = JSON.stringify(cdata);
    //Apperyio.storage.json_news_filtered.set(cdata_filtered);
    //alert(cdata_filtered);

    settings.success(cdata_filtered);
    settings.complete('success');

    }
    settings.complete('success');
    }

    });


    This is the javascript I'm using to search the data:


    Appery.get_cache_news_searched_js = Appery.createClass(null, {

    init: function (requestOptions) {
    this.__requestOptions = $.extend({}, requestOptions);
    },

    process: function (settings) {
    settings.beforeSend(settings);
    if (this.__requestOptions.echo) {
    settings.success(this.__requestOptions.echo);
    } else {

    var cdata = JSON.parse(Apperyio.storage.json_news.get());
    var search_term = Apperyio.storage.search_term.get();
    localStorage.removeItem("search_found");

    var search_data = [];
    jQuery.grep(cdata.posts, function (post, key) {
    var found = false;
    if (post.content.toLowerCase().indexOf(search_term.toLowerCase()) > 0) {
    search_data.push(post);
    found = true;
    Apperyio.storage.search_found.set(found);
    }
    });
    cdata.posts = search_data;

    var cdata_searched = JSON.stringify(cdata);
    //Apperyio.storage.json_news_searched.set(cdata_searched);

    settings.success(cdata_searched);
    settings.complete('success');

    }
    settings.complete('success');
    }

    });


    Since the upgrade I have changed all localstorage calls to use your storage API, but this did not fix the problem.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited kidding, amused, unsure, silly sad, anxious, confused, frustrated indifferent, undecided, unconcerned

  • 1
    Hi Chris,

    Please replace:
    settings.success(cdata_searched);
    With:
    settings.success(cdata);
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited kidding, amused, unsure, silly sad, anxious, confused, frustrated indifferent, undecided, unconcerned

  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited kidding, amused, unsure, silly sad, anxious, confused, frustrated indifferent, undecided, unconcerned