English 中文(简体)
当地储存的实施
原标题:Local Storage implementation

I am trying to save my configuration page in local storage and retrive it later. I am not quite sure how to do that. When i try to load the store using "store.load" but it says load is undefined.

我的组合页码

var flag = 1;
var count = 3;
var apptitle;
Ext.define("InfoImage.view.Settings",{
                    extend :  Ext.form.Panel ,
                    requires : [
                    // InfoImage.view.workItemPanel ,
                     Ext.TitleBar ,  Ext.field.Text ,  Ext.field.Toggle ,
                             Ext.field.Select ,  Ext.layout.HBox ,
                             Ext.field.Number ,  Ext.field.Checkbox ,
                             Ext.form.FieldSet ,  Ext.field.Password ,
                             Ext.field.Url  ],
                    xtype :  settingsPanel ,
                    id :  settings ,
                    config : {
                        //store: configStore ,
                        scrollable : {
                            direction :  vertical 
                        },
                        items : [
                                {
                                    xtype :  toolbar ,
                                    ui :  dark ,
                                    docked :  top ,
                                    id: myTitle ,
                                    title :  InfoImage Settings ,
                                    items : [
                                    {
                                        xtype :  button ,
                                        iconCls :  home ,
                                        iconMask : true,
                                        ui :  normal ,
                                        id :  homeSettingbtn 
                                    },

                                    {xtype:  spacer },
                                    {
                                        xtype :  button ,
                                        //text: Save ,
                                        iconCls :  save_fin ,
                                        iconMask : true,
                                        ui :  normal ,
                                        id :  savebtn ,
                                        handler : function() {
                                        }
                                    }, 
                                    {
                                        xtype :  button ,
                                        //text: Default ,
                                        iconCls :  default ,
                                        iconMask : true,
                                        ui :  normal ,
                                        handler : function() {
                                            var form = Ext.getCmp( settings );
                                            form.reset();
                                        }

                                    }

                                    ]
                                },

                                {
                                    //fieldset defined for the Server Configuration details to be entered.
                                    xtype :  fieldset ,
                                    title :  Server Configuration ,
                                    defaults : {
                                        xtype :  selectfield ,
                                        labelWidth :  30% ,
                                    },
                                    items : [
                                            {
                                                xtype :  urlfield ,
                                                name :  servname ,
                                                id :  servname ,
                                                label :  Server Name ,
                                                labelWidth :  30% 
                                            },
                                            {
                                                xtype :  numberfield ,
                                                id :  port ,
                                                name :  port ,
                                                label :  Port ,
                                                value :  80 ,
                                                labelWidth :  30% 
                                            },
                                            {
                                                xtype :  selectfield ,
                                                name :  protocol ,
                                                id :  protocol ,
                                                label :  Protocol ,
                                                labelWidth :  30% ,
                                                usePicker : false,
                                                //ui: action ,
                                                //styleHtmlContent:true,
                                                //visible:true,
                                                //fieldStyle: background-color:#FFF; ,
                                                handler : function() {
                                                },
                                                options : [ {
                                                    text :  HTTP ,
                                                    value :  HTTP 
                                                }, {
                                                    text :  HTTPS ,
                                                    value :  HTTPS 
                                                }

                                                ]
                                            }

                                    ]
                                },
                                {
                                    //fieldset defined for the User Configuration details to be entered.
                                    xtype :  fieldset ,
                                    title :  User Configuration ,
                                    items : [ {
                                        xtype :  textfield ,
                                        name :  username ,
                                        id :  username ,
                                        label :  User Name ,
                                        labelWidth :  30% 
                                    }, {
                                        xtype :  passwordfield ,
                                        name :  password ,
                                        id :  password ,
                                        label :  Password ,
                                        labelWidth :  30% 
                                    }, {
                                        xtype :  textfield ,
                                        id :  domain ,
                                        name :  domain ,
                                        label :  Domain ,
                                        labelWidth :  30% 
                                    } ]
                                },



                                {
                                    //fieldset defined for the App Subtitle to be entered.
                                    xtype :  fieldset ,
                                    items : [ {
                                        xtype :  textfield ,
                                        name :  apptitle ,
                                        id :  apptitle ,
                                        label :  App Subtitle ,
                                        labelWidth :  30% ,
                                        value :  Mobile Client Work Manager 
                                    } ]
                                }

                        ]

                    }
                });

以及我的控制员的守则。 j)

Ext.getCmp( settings ).getStore().load();

在当地储存和重新储存这些数据,应该做些什么?

最佳回答

我认为,这里的问题是:

//store: configStore ,

也许你们应该对此不满意。

供当地编辑阅读的数据:

Ext.getCmp( settings ).getStore().load();

向当地记者撰写数据:

Ext.getCmp( settings ).getStore().add(data);
Ext.getCmp( settings ).getStore().sync();

sync()方法用于使Sencha的储存与“超5”地方Storage同步进行(如果我正确的话——它为100 000人工作)。

问题回答

暂无回答




相关问题
Is there an equivalent to localStorage in React Native?

I d like to implement the equivalent to the javascript localStorage in my React Native app. But I m unsure how to set. To function how I want it to, I would like the localStorage to be stored every ...

Local Database Storage default data

I have developed application using HTML 5 Localstorage. How can I create a TABLE and populate 10000+ rows before initializing my HTML 5 enabled application. Please suggest a pattern.

When do items in HTML5 local storage expire?

For how long is data stored in localStorage (as part of DOM Storage in HTML5) available? Can I set an expiration time for the data which I put into local storage?

Sharing variables between web workers? [global variables?]

Is there any way for me to share a variable between two web workers? (Web workers are basically threads in Javascript) In languages like c# you have: public static string message = ""; static void ...

How to store objects in HTML5 localStorage/sessionStorage

I d like to store a JavaScript object in HTML5 localStorage, but my object is apparently being converted to a string. I can store and retrieve primitive JavaScript types and arrays using localStorage, ...

Limit of localstorage on iPhone?

I m wondering what s the limit of localstorage HTML 5 on iPhone? I read that it was like 5 Mb, but I m surprised is so little. Any ideas?

HTML5 localStorage & SQL

I understand that HTML5 "localStorage" is a key:value store but I am wondering if there is a Javascript library available that offers a more SQL-ish API?

热门标签