0
我是新來的sencha touch。我有一個文本字段,用戶類型的一些數據:如何根據輸入的文本字段值在sencha中進行查詢?
{
xtype: 'textfield',
id: 'road',
placeHolder :'Road',
label: 'Road'
},
當用戶鍵入搜索在此一定的價值和點擊它必須查詢數據庫並獲取相應的結果。
xtype: 'button',
text: 'Search',
handler: function() {
var x=Ext.getCmp('road').getValue();
alert(x); // i can get value here.
db.transaction(
function (transaction) {
transaction.executeSql('SELECT * FROM Journal where id=x;', [],display, null);
}
);
myapp.Viewport.setActiveItem('mylist', {type:'slide', direction:'left'});
}
這個select查詢的作品如果我把ID = 1;但不是當我從Ext.getcmp獲取id = x時。我在這裏獲得運行時的價值。所以在編譯時x是空的。請告訴我如何查詢它。