Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6095701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:50:30+00:00 2026-05-23T12:50:30+00:00

I have created a local store and model for remembering username and password: Store

  • 0

I have created a local store and model for remembering username and password:

Store:

ToolbarDemo.stores.localsettingsstore = new Ext.data.Store({
    model: 'UserSettings',
    proxy: new Ext.data.LocalStorageProxy(
    {
        id: 'data',
        proxy: 
        {
            idProperty: 'id'
        }
    }),
    autoLoad: true,
    autoSave: true,
    listeners:
    {
        beforesync: function()
        {
            console.log("SYNCING");
            console.log("Number of data: ");
            console.log(this.getCount());
        },
        datachanged: function()
        {
            console.log(this.getProxy());
            console.log("DATA CHANGED");
            console.log("Number of data: ");
            console.log(this.getCount());
        }
    }

});

Model:

Ext.regModel('UserSettings', {
    fields: [
        {name: 'username', type: 'string'},
        {name: 'password', type: 'string'},
        {name: 'storeUsernamePassword', type: 'boolean'}
    ]
});

If the user want to store the username and password, this function is invoked:

function setLocalUsernameAndPassword(localUsername, localPassword, bStoreUsernameAndPassword)
{
    removeLocalUsernameAndPassword(false); // Remove all previous inputs (Should just be one)
    ToolbarDemo.stores.localsettingsstore.add({username: localUsername, password: localPassword, storeUsernamePassword: bStoreUsernameAndPassword});

}

The store is set to autoload and autosave, so it should not be nessecary to run a .sync() on the store.

If the user chooses to not store the username and password, i remove all records from the store by invoking:

function removeLocalUsernameAndPassword(bClearFields)
{
    //ToolbarDemo.stores.localsettingsstore.removeAll();
    ToolbarDemo.stores.localsettingsstore.each(function(record)
    {
        console.log("Removing " + record.data.username);
        ToolbarDemo.stores.localsettingsstore.remove(record);
    });

    if(bClearFields)
    {
        Ext.getCmp("usernameField").value = "";
        Ext.getCmp("passwordField").value = "";
        Ext.getCmp("checkboxStoreUserInfo").checked = false;
    }

}

Afterwards i can see that the store is empty, BUT if i refresh the page (Start the app once again), all the records are back plus the one i stored.

Can anyone see what i’m missing to do this properly?

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:50:31+00:00Added an answer on May 23, 2026 at 12:50 pm

    I finally found a guy that had exactly the same problem.
    The solution:

    You have to add a field with name “id”, and type “int”.
    This makes sencha able to delete the record.

    Ext.regModel('UserSettings', {
        fields: [
            {name: 'id', type: 'int'},
            {name: 'username', type: 'string'},
            {name: 'password', type: 'string'},
            {name: 'storeUsernamePassword', type: 'boolean'}
        ]
    });
    

    After i did this, i also had to do a store.save() after each update.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For a new project I have created a local folder tree with empty Visual
I have a local branch work, where I created two new files a.py, b.py
My issue is that I have created a table for a local db in
I have a local repository. I created the whole application, but now I want
So I have a local SQLite table breadcrumbs being created on the Android device.
I have created a model that is populated locally on the client, upon initializing
I have created a database emailDatabase , its stored in C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA
Hi i am going to store data into a local .db in my android
I have a model called store which have defined this: def gmaps4rails_infowindow html_window =
I have two questions. How can I get the SQLite Db to store data?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.