1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    12
    Vote Rating
    0
    erinhir is on a distinguished road

      0  

    Default Answered: Some quick questions

    Answered: Some quick questions


    Hello,

    I am making a simple app, but there are some details that need to be fixed but I have some problems with it.
    With the app you can just add objects (via a little form), for the moment I add the objects to the local store. The added object are also displayed in a list and can be removed and edited.

    This all works but there are some minor problems:

    1/ In my form I use a listbox

    Code:
    xtype : 'selectfield',
                        name : 'idRef_sport',
                        label : "Sport",
                        options : [
                            {
                                text : 'Cycling',
                                value : '1',
                            },
                            {
                                text : 'Running',
                                value : '2',
                            }
                        ],
                        required: 'true',
    The stored value is off course "1" or "2". When I want to display the objects in the list, it shows the values "1" or "2" instead of "Cycling" or "Running". How can I show the corresponding values of 1 and 2, namely Cycling and Running?

    Also, when I want to edit an object, in the form, the value of the listbox is "1" or "2". How can I make that the correct value is selected in the listbox. Cycling or Running.

    2/ There is a problem in my layout displaying the stored objects in the list

    Code:
    list = {
                xtype: 'list',
                itemTpl: new Ext.XTemplate('<tpl for=".">','<div class=\"sport{idRef_sport}\">{tijd_h}u{tijd_m}m{tijd_s}s {afstand}km {avg_hr}bpm<br />{commentaar}</div>','</tpl>'),
                store: App.stores.training,
                listeners: {
                    scope: this,
                    itemtap: this.onItemtapAction
                }
            };
    Depending on the selected sport I want to give the background of the item a certain colour. This works but not the complete line of the list is given the color. Only the "div". So there is still a border around the div withouth a color.

    Another important thing, I am no expert in sencha touch. This is my first app. So be gentle ;-)

    thanks
    Erinhir

  2. So you have int as the type but in the selectfield you have the value as a string.

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,754
    Answers
    3462
    Vote Rating
    828
    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


    I'm seeing the text value correctly with this code:

    Code:
    new Ext.form.FormPanel({
        fullscreen : true,
        items      : [
            {
                xtype    : 'selectfield',
                name     : 'idRef_sport',
                label    : "Sport",
                options  : [
                    {
                        text  : 'Cycling',
                        value : '1'
                    },
                    {
                        text  : 'Running',
                        value : '2'
                    }
                ],
                required : true
            }
        ]
    });
    For your list, does the model or store have a idRef_sport field?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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.

  4. #3
    Sencha User
    Join Date
    Apr 2012
    Posts
    12
    Vote Rating
    0
    erinhir is on a distinguished road

      0  

    Default


    Yes, this is my model:

    Code:
    App.models.Training = Ext.regModel('Training', {
        fields: [
            {
                name: 'id',
                type: 'int'
            }, {
                name: 'idRef_sport',
                type: 'int'
            }, {
                name: 'Date',
                type: 'date'
            }, {
                name: 'time_h',
                type: 'int'
            }, {
                name: 'time_m',
                type: 'int'
            }, {
                name: 'time_s',
                type: 'int'
            }, {
                name: 'distance',
                type: 'int'
            }, {
                name: 'avg_hr',
                type: 'int'
            }, {
                name: 'altitude',
                type: 'int'
            }, {
                name: 'comment',
                type: 'string'
            }
        ],
    
        validations: [
            {
                type: 'presence',
                name: 'date'
            },{
                type: 'presence',
                name: 'idRef_sport'
            }, {
                type: 'presence',
                name: 'distance'
            }, {
                type: 'presence',
                name: 'time_h'
            }
            , {
                type: 'presence',
                name: 'time_m'
            }
            , {
                type: 'presence',
                name: 'time_s'
            }
        ],
    
        proxy: {
            type: 'localstorage',
            id: 'log-training'
        }
    });
    In my form i see the values, cycling, running, etc. But when i add a new training and i go to the list with trainings, i don't see the values cycling, running, etc but the values 1,2,etc. How can i get the corresponding correct values to be displayed?

    thanks

  5. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,754
    Answers
    3462
    Vote Rating
    828
    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


    So you have int as the type but in the selectfield you have the value as a string.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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.

  6. #5
    Sencha User
    Join Date
    Apr 2012
    Posts
    12
    Vote Rating
    0
    erinhir is on a distinguished road

      0  

    Default


    Cool you are correct. I changed it to an int and when i want to edit a training, the selectlist is correctly filled in.
    But how can i show the corresponding value "cycling" or "running" in my list?

    thanks

  7. #6
    Sencha User
    Join Date
    Apr 2012
    Posts
    12
    Vote Rating
    0
    erinhir is on a distinguished road

      0  

    Default


    I don't understand. There are still 2 questions unanswered?

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi