Storing App User preferences in LocalStorage

Thread is closed for posting
2 posts, 0 answers
  1. David
    David avatar
    13 posts
    Member since:
    Apr 2013

    Posted 08 Dec 2015 Link to this post

    I am looking to store some user preference settings in LocalStorage.  Is there a good hybrid sample (or full set of example code) out there that shows how to set the datasource to localstorage and use the Kendo UI listview?  Is there a Best Practice for storing user preferences?
  2. Tsvetina
    Tsvetina avatar
    2481 posts

    Posted 11 Dec 2015 Link to this post

    Hi David,

    You shouldn't need the DataSource to read and store user preferences. You just need to define methods to read the user preferences on start of the app (deviceready event) from local storage and to store new preferences if the user modifies them.

    What do you need to display in the ListView? If it is a list of all preferences, you can just create an object that stores all preferences, e.g. :
    app.homeView = kendo.observable({
        preferences: {
            location: "London",
            language: "en-US",
            timeZone: "GMT",
            sendNotifications: false

    Then, you can define a static ListView bound to these preferences:
    <div data-role="view" data-title="Home View" data-layout="main" data-model="app.homeView" >
            <ul data-role="listview">
                <li><label>Location: </label><span data-bind="text: preferences.location"></span></li>
                <li><label>Language: </label><span data-bind="text: preferences.language"></span></li>
                <li><label>Time zone: </label><span data-bind="text: preferences.timeZone"></span></li>
                    <label>Get notifications:</label>
                    <span style="color:green" data-bind="visible:preferences.sendNotifications">Yes</span>
                    <span style="color:red" data-bind="invisible:preferences.sendNotifications">No</span>

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top