1. #1
    Sencha User
    Join Date
    Jun 2010
    Location
    india
    Posts
    13
    Vote Rating
    0
    arunsathyan is on a distinguished road

      0  

    Default Setting selectfield displayitem text and value from local storage

    How to set Select field selected value from local storage? the select field is already populated from a store and last selected value is in local storage, i need to retail it when i reopens the app.

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    38,546
    Vote Rating
    1120
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default

    How are you saving the value?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Jun 2010
    Location
    india
    Posts
    13
    Vote Rating
    0
    arunsathyan is on a distinguished road

      0  

    Default

    thanks for the replay , i have fixed this

  4. #4
    Sencha User
    Join Date
    Mar 2013
    Posts
    16
    Vote Rating
    0
    ppurohit is on a distinguished road

      0  

    Default

    Hey, I am new to the sencha touch...
    I have created a controller and a 2 views...
    I have saved the data from 1st view into the controller..
    Now I want to access that data into second view...

    Please Help....

  5. #5
    Sencha User
    Join Date
    Jun 2010
    Location
    india
    Posts
    13
    Vote Rating
    0
    arunsathyan is on a distinguished road

      0  

    Default

    How you are saving the data? Local store?

  6. #6
    Sencha User
    Join Date
    Mar 2013
    Posts
    16
    Vote Rating
    0
    ppurohit is on a distinguished road

      0  

    Default

    No I am storring it in controller using the fireEvent of button.... i.e when button is clicked the event is generated and object is created and the object is redirected to the controller... I have printed it on console.. but not able to take the data to another view.. Plz help....

    Thanks

  7. #7
    Sencha User
    Join Date
    Jun 2010
    Location
    india
    Posts
    13
    Vote Rating
    0
    arunsathyan is on a distinguished road

      0  

    Default

    we can do this in different ways, please share the code you are trying

  8. #8
    Sencha User
    Join Date
    Mar 2013
    Posts
    16
    Vote Rating
    0
    ppurohit is on a distinguished road

      0  

    Default

    Settings.js (My Controller)

    Ext.define('MobileClient_HTML5.controller.Settings',{
    extend: 'Ext.app.Controller',
    requires:['MobileClient_HTML5.view.Setting'],
    config:{
    refs:{
    SettingsView: 'settingform',
    //mainmenuView: 'mainmenuview'
    },
    control:{
    SettingsView:{ saveCommand: 'onSaveCommand'},




    //changeSettingCommand: 'onChangeSettingCommand'},
    //activate: 'onActivate'
    }
    },
    onSaveCommand: function (view, servername,port, contextRoot)
    {
    console.log('servername: '+servername+'\n'+'port: '+ port+'\n'+'contextRoot: '+ contextRoot);
    }
    });

    View/setting.js (Where I accept the data)

    Ext.define('MobileClient_HTML5.view.Setting', {
    extend: 'Ext.form.Panel',
    alias: "widget.settingform",
    fullscreen: 'fit',
    requires: ['Ext.TitleBar', 'Ext.form.FieldSet', , 'Ext.Img', 'Ext.util.DelayedTask','Ext.Label'],
    config: {
    title: 'Settings',
    iconCls: 'settings',


    items: [
    {
    xtype: 'titlebar',
    title: 'Server Settings',
    docked: 'top'
    },
    {
    xtype: 'fieldset',
    //title: 'Server Settings',
    items: [
    {
    xtype: 'textfield',
    label:'Server Name:',
    placeHolder: 'Enter the name of Server',
    itemId: 'serverNameTextField',
    name: 'serverNameTextField',
    required: true
    },
    {
    xtype: 'textfield',
    label:'Port Number:',
    placeHolder: 'Enter the Port Number',
    itemId: 'portTextField',
    name: 'portTextField',
    required: true
    },
    {
    xtype: 'textfield',
    label:'Context Root:',
    placeHolder: 'Enter the Context Root',
    itemId: 'contextTextField',
    name: 'contextTextField',
    required: true
    }
    ]
    },
    {
    xtype: 'toolbar',
    layout: {
    pack: 'center'
    }, // layout
    ui: 'plain',
    items:[{
    xtype: 'button',
    itemId: 'saveButton',
    ui: 'confirm',
    text: 'Save'
    }
    ]

    }
    ],
    listeners: [{
    delegate: '#saveButton',
    event: 'tap',
    fn: 'onSaveButtonTap'
    }]
    },
    onSaveButtonTap: function () {


    var me = this,
    servernameField = me.down('#serverNameTextField'),
    portField = me.down('#portTextField'),
    contextField=me.down('#contextTextField'),
    label = me.down('#signInFailedLabel'),
    servername = servernameField.getValue(),
    port = portField.getValue(),
    contextRoot = contextField.getValue();


    //console.log(servername);
    //console.log(port);
    //console.log(contextRoot);
    //label.hide();


    // Using a delayed task in order to give the hide animation above
    // time to finish before executing the next steps.
    var task = Ext.create('Ext.util.DelayedTask', function () {
    //label.setHtml('');
    me.fireEvent('saveCommand', me, servername, port, contextRoot);


    servernameField.setValue('');
    portField.setValue('');
    contextField.setValue('');
    });


    task.delay(500);


    },
    showSignInFailedMessage: function (message) {
    var label = this.down('#signInFailedLabel');
    label.setHtml(message);
    label.show();
    }
    });


    Now I want to carry the Data (ServerName, port, context path) to another view...

    this is the first view of myapp.. Can i navigate the values here?

    Ext.define("MobileClient_HTML5.view.Main", {
    extend: 'Ext.tab.Panel',
    id:'tabpnl',
    requires: ['Ext.TitleBar','Ext.field.Select','Ext.field.Search'],


    config: {
    tabBarPosition: 'bottom',
    //text:'Mobile Cube',
    styleHtmlContent: true,
    xtype: 'fieldset',
    items: [

    {
    xtype:'homeform'
    },
    {
    // xtype:'storepanel'
    xtype:'mainmenuview',
    },

    {
    xtype:'accountform'
    },
    {
    xtype:'orderform'
    },
    {
    xtype:'settingform'
    },

    ]
    }
    });




    I don't Know how to do it..


    Plz Help...
    Thanks....