顯示具有 ext js 4 標籤的文章。 顯示所有文章
顯示具有 ext js 4 標籤的文章。 顯示所有文章

2013年10月23日 星期三

Extjs 4 使用 google speech api



想要在自行開發的網頁上能使用 google speech api 的話,input 要加上 x-webkit-speec 和 speech,
那如果使用 Extjs上要如何作呢。

因為我是使用 Extjs MVC,所以原本要在 Controller上加上 render function,但都沒有作用,所以還是把 render移回到 view上,程式碼如下

View :原本程式碼加上 listener

xtype: 'textfield',
,renderTo: Ext.getBody()
,listeners:: {
    render: function(cmp) {
cmp.el.dom.firstChild.firstChild.lastChild.firstChild.setAttribute("x-webkit-speech","x-webkit-speech");
cmp.el.dom.firstChild.firstChild.lastChild.firstChild.setAttribute("speech","speech");
     }

}

Controller: 加上 webkitspeechchange function

init: function() {
    this.control({
               'tellist textfield[name=param]' :{
        
            /* for google speech api*/
                    ,webkitspeechchange: function(fld,e) {
       
        this.doFetchTel();
                   }
     
                 }

    });  
     
}

這樣應該就可以使用了

2012年10月31日 星期三

Create an iFrame Window for Ext Js 4

使用 autoEL這個方式就可以

items : [{
xtype
: "component",
autoEl
: {
tag
: "iframe",
src
: "http://www.yahoo.com"
}
}]


參考網址
http://stackoverflow.com/questions/6025814/extjs-4-create-an-iframe-window