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

I have a local branch work, where I created two new files a.py, b.py
I have a local git repository created with git svn clone . I make
I have created a model that is populated locally on the client, upon initializing
Hi i am going to store data into a local .db in my android
I have a method that creates a local textfield and pops up the keyboard
I have been playing around with GC.GetTotalMemory(). When I create a local variable of
I have an SQL CREATE PROCEDURE statement that runs perfectly in my local SQL
Have created a c++ implementation of the Hough transform for detecting lines in images.
I have created a template for Visual Studio 2008 and it currently shows up
I have created a custom dialog for Visual Studio Setup Project using the steps

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.