2014-07-12から1日間の記事一覧

Ext.apply と Ext.applyIf の違い

Ext.applyは、対象オブジェクトに対して、全てのプロパティを代入する。 console.log(this.foo); // undefined var ret = Ext.apply(this, { foo: 'bar', hoge: 'piyo' }); console.log(this.foo); // bar Ext.applyIfは同じプロパティが存在する場合、上書…

extJSでオブジェクトとJSONの変換

Ext.encode()、Ext.decode()を使う var o = {test: "test2"}; console.log(o); console.log(Ext.encode(o)); console.log(Ext.decode(Ext.encode(o))); 結果 Object {test: "test2"} {"test":"test2"} Object {test: "test2"}

extJSにおけるscopeの意味

scopeなし launch: function () { Ext.Ajax.request({ success: function(response){ // エラーになる store = this.getMyJsonStoreStore(); } }); } scopeにthisを指定 launch: function () { Ext.Ajax.request({ success: function(response){ // エラーに…

javascriptで改行を含んだ正規表現

text.match(/[\s\S]*/); [\s\S]は改行を含む任意の一文字ということになる複数行にマッチさせる正規表現 | You Look Too Cool

jqueryのセレクタの第2引数の意味

var ele = $('#id', var_html); $()の第2引数にhtmlエレメントを指定すると、#idの検索対象をそのhtmlに設定することができる $(var_html).find('#id') これも同じ意味ぽい