Relax
Relax

Reputation: 75

how to convert html in to sencha touch

I have this pure code in HTML

<body style="margin:0px; padding:0px;" onload="load()"> 
    <div>
     <input type="text" id="addressInput" size="10"/>
    <select id="radiusSelect">
      <option value="25" selected>25mi</option>
      <option value="100">100mi</option>
      <option value="200">200mi</option>
    </select>
    <input type="button" onclick="searchLocations()" value="Search"/>
    </div>
    <div><select id="locationSelect" style="width:100%;visibility:hidden"></select></div>
    <div id="map" style="width: 100%; height: 80%"></div>
  </body>

what i am trying in sencha Touch 2 is

items: [{
                    xtype: 'fieldset',
                    title: 'Search Stores',

                    items: [
                        {
                            xtype: 'textfield',
                            name : 'name',
                            label: 'Adress',
                            placeHolder: 'Enter City & State or ZIP code'
                        },
                       {
                            xtype: 'selectfield',
                            label: 'Radius:',
                            options: [
                                {text: '25mi',  value: '25'},
                                {text: '100mi', value: '100'},
                                {text: '200mi',  value: '200'}
                            ]
                        }
                    ]
            }]

Actually I am working on finding the store using sencha touch 2 and i follow this link https://developers.google.com/maps/articles/phpsqlsearch_v3

this works fine for me but this code is not sufficient, now i want to know how can i call this from sencha touch 2 onload="load(), onclick="searchLocations()", visibility:hidden I read the documentation of sencha touch but not able to do that any help is highly appreciated

Upvotes: 2

Views: 1092

Answers (1)

Saurabh Gokhale
Saurabh Gokhale

Reputation: 46395

Here's equivalent code of your HTML in Sencha touch

  • <input type="button" onclick="searchLocations()" value="Search"/>

     {
      xtype: 'button',
      text: 'Search',
      ui: 'confirm',
      listeners : {
          tap : function() {
            // body of searchLocations()
          }
      }
     }  
    
  • For visibility:hidden, use the following property of selectfield

     hidden: true
    
  • For onload="load()", you can call following method of Component.

     initialize()
    

Upvotes: 2

Related Questions