วิธีแปลง html เป็น sencha touch

ฉันมีโค้ดบริสุทธิ์นี้เป็น 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>

สิ่งที่ฉันกำลังลองใน sencha Touch 2 คือ

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'}
                            ]
                        }
                    ]
            }]

จริงๆ แล้วฉันกำลังค้นหาร้านค้าโดยใช้ sencha touch 2 และฉันไปที่ลิงก์นี้ https://developers.google.com/maps/articles/phpsqlsearch_v3

มันทำงานได้ดีสำหรับฉัน แต่รหัสนี้ไม่เพียงพอ ตอนนี้ฉันต้องการทราบว่าฉันจะเรียกสิ่งนี้จาก sencha touch 2 ได้อย่างไร onload="load(), onclick="searchLocations()", visibility:hidden ฉันอ่านเอกสารของ sencha touch แต่ไม่สามารถทำได้ ความช่วยเหลือใด ๆ ได้รับการชื่นชมอย่างสูง


person Relax    schedule 09.05.2012    source แหล่งที่มา
comment
คุณต้องการโค้ดที่เทียบเท่ากับ html ของคุณใน sencha touch หรือไม่?   -  person Saurabh Gokhale    schedule 09.05.2012
comment
@roadRunner ใช่ และหลังจากนั้น ฉันก็ติดตามอีกครั้งที่ลิงก์นี้ developers.google.com/maps/articles/phpsqlsearch_v3 และค้นหาร้านค้าโดยใช้ Sencha touch 2   -  person Relax    schedule 09.05.2012


คำตอบ (1)


นี่คือโค้ดที่เทียบเท่ากับ HTML ของคุณใน Sencha touch

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

     {
      xtype: 'button',
      text: 'Search',
      ui: 'confirm',
      listeners : {
          tap : function() {
            // body of searchLocations()
          }
      }
     }  
    
  • สำหรับ visibility:hidden ให้ใช้คุณสมบัติต่อไปนี้ของ selectfield

     hidden: true
    
  • สำหรับ onload="load()" คุณสามารถเรียกใช้เมธอด Component ดังต่อไปนี้

     initialize()
    
person Saurabh Gokhale    schedule 09.05.2012
comment
และสำหรับ body onload=load() ?? - person Relax; 09.05.2012
comment
ตอนนี้ฉันไม่มีคำถามใด ๆ หากเกิดขึ้น ฉันจะถามในภายหลังขอบคุณ - person Relax; 09.05.2012