[Android]Cordova使用Sqlite資料庫

什麼是SQLite?

SQLite是一個軟體資料庫,不需要架設在伺服端的自主資料庫,用來存放數據資料。

行動裝置上對於資料的存取需求相對比少,不太需要大量的記憶體及cpu,對於行動裝置是個很好的選擇。

當我們利用Cordova/PhoneGap開發行動裝置時,可以增加plugin來支援Sqlite的使用,再結合html 5、CSS、Javascript就可以存取資料並顯示其結果。

Cordova plugin SQLite

https://github.com/brodysoft/Cordova-SQLitePlugin

A Cordova/PhoneGap plugin to open and use sqlite databases on Android/iOS/WP(8) with HTML5 Web SQL API

Native interface to sqlite in a Cordova/PhoneGap plugin for Android/iOS/WP(8), with HTML5 Web SQL API

License for Android & WP(8) versions: MIT or Apache 2.0

License for iOS version: MIT only

舊的專案網址

Read More

[ExtJS]常用一般function

  • Ajax範例
    //啟動時遮照
    Ext.Ajax.on('beforerequest', function () {
        Ext.getBody().mask("Loading");
    }, this);
    //結束時移除遮照
    Ext.Ajax.on('requestcomplete', function () {
        Ext.getBody().unmask();
    }, this);
    var paramObj = new Object();
    paramObj.id = "123";
    //Ext.getBody().mask("Loading2");
    Ext.Ajax.request({
        url: "MyAjax.jsp",
        scope: this,
        method: "post",
        success: function (
        response) {
            Ext.getBody()
                .unmask();
            var json = Ext.decode(response.responseText);
            //{success:false|true,msg:'訊息'}
            if (json.success) {
                //回傳success要做的事
            } else {
                //錯誤時alert
                alert(json.msg);
    
            }
    
        }, // .createDelegate(this),
        failure: function () {
            if (action.response.status == 200) {
    
                var json = Ext.decode(action.response.responseText);
                Ext.MessageBox.alert(json.msg);
            } else Ext.MessageBox.alert("Save Error~");
        },
    
        params: paramObj
    });