1. #1
    Sencha User
    Join Date
    May 2012
    Posts
    65
    Vote Rating
    0
    ehboym is on a distinguished road

      0  

    Default What would be the "Sencha way" for this code

    What would be the "Sencha way" for this code


    Hi,

    I just created my very 1st Sencha webapp. Since I am new to Sencha and the documentation is not that perfect I was forced to make some guesses to make things work the way I wanted. Although everything is working I am pretty shore that what I had done is not the "Sencha Way".

    So, here is my code. I would love to know what would be the right Sencha way to make it happen.

    The part I am not shore of is a response to a itemtap event, so my controller is :
    Code:
    Ext.define('iStatView.controller.Main', {
        extend: 'Ext.app.Controller',
        
        config: {
            refs: {
                UsersList: 'UsersList'
            },
            control: {
                'UsersList list': {
                    itemtap: 'ShowInfo'
                }
            }
        },
        
        ShowInfo: function(List, Index, Element, Record){
            this.getUsersList().push({
                xtype: 'panel',
                id: "StatPanel",
                title: 'Stats for ' + Record.get('UserID'),
                
                scrollable: true,
                stylehtmlcontent: true
            });
            
            Ext.data.JsonP.request({
                url: '<a php code which return json data>',
                callbackKey: 'callback',
                params:{
                    UserID: Record.get('UserID')
                },
                success: function(result, request) {
                    var StatPanel    = Ext.getCmp("StatPanel");
    
    
                    for (var SectionIndex in result){
                        var StatFieldSet = StatPanel.insert(100, {xtype: 'fieldset', title: SectionIndex, id: SectionIndex});
                        
                        if (result[SectionIndex] == "No Data"){
                            StatFieldSet.insert(100, {xtype: 'textfield', label: '', value: 'No Data'});
                        }
                        else {
                            for (var ParamIndex in result[SectionIndex]){
                                StatFieldSet.insert(100, {xtype: 'textfield', label: ParamIndex, value: result[SectionIndex][ParamIndex]});
                            }
                        }
                    }
                }
            });
        }
    });
    The JSON data I get back from the php is a bit longer then what you see below what you get the idea ;-):
    Code:
    {
        "SystemData": {
            "WidgetVersion": "05.03.00",
            "Platform": "windows",
            "UserID": "E080760",
            "DateTime": "20120610180003",
            "StartTime": "20120609015351",
            "UpTime": "2586"
        },
        "LastUpdate": {
            "UTCSync": "20120610000003",
            "Version": "20120610000004",
            "Statistics": "20120610000001",
            "Weather": "20120610170004",
            "SigMet": "20120610170004",
            "NATTracks": "20120610170005",
            "EFRAS": "20120610000007",
            "Songkick": "20120610000011",
            "Notam": "20120610170008",
            "MyRotemFlights": "20120609112530"
        }
    }
    Thanks for any ideas, comments, enlightenments .....

    Erez

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


    First you should post in the correct forum. Ext JS 4 or Sencha Touch 2 so I can move it?
    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.

  3. #3
    Sencha User
    Join Date
    May 2012
    Posts
    65
    Vote Rating
    0
    ehboym is on a distinguished road

      0  

    Default


    Please do.

    Thanks

    ErezPlease

Thread Participants: 1

Tags for this Thread

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