顯示具有 【ExtJS】經驗分享 標籤的文章。 顯示所有文章
顯示具有 【ExtJS】經驗分享 標籤的文章。 顯示所有文章

2012年3月23日

【三年前作品】WebHD



最近突然翻到以前寫得程式

三年前到現在

完全無進展XDD

想當初還是熱血青年

想說寫網頁也有段時間了

也是該寫個系統給自己用用

當時還沒有DropBox

我也只有一台破破的server

但當初靠這系統讓我出門在外

不管是幫人修電腦還是上課筆記

都不愁沒地方放

算是很方便啦

但其實改版之後根本沒寫完XDD

說忙其實也還好(根本就是懶惰)

現在把原始碼放出來

前台用的是ExtJS 3.X

後台是 PHP + MySQL


目前完成的功能有

右鍵處理檔案與資料夾、搜尋

拖曳方式移動檔案與資料夾

多選檔案上傳

簡單來說就是基本的瀏覽、管理 檔案、資料夾功能都有

只差修一些bug和加入登入畫面


Source code:
http://code.google.com/p/web-hard-disk/

有興趣的人可以繼續完成它XDD

2009年7月28日

【ExtJS】element.fadeIn

喜歡特效的朋友們

應該都有種困擾

就是fadeIn特效

每次Opacity都從0開始

對大一點的圖片或區塊作這種特效

看了會很刺眼

所以還可以使用

element.setOpacity + animation 參數

來控制特效開始的透明度唷 ^_^

2009年2月23日

【ExtJS】Grid 資料可用拖拉方式交換

var ddrow = new Ext.dd.DropTarget(Grid.getView().mainBody, {

            ddGroup : 'ddGroup',

            copy:false,

            notifyDrop : function(ddSource, e, data){

               

                var sm = Grid.getSelectionModel();

                var rows = sm.getSelections();

                var cindex = ddSource.getDragData(e).rowIndex;

                if (!this.copy){

                    for(i = 0; i < rows.length; i++) {

                        ds.remove(ds.getById(rows[i].id));

                    };

                };

                ds.insert(cindex,data.selections);

    

            }

});



grid 別忘了將 enableDragDrop設為true

2008年12月1日

【ExtJS】Ajax Communication failure 解決方法

只需在Ajax failure function 內加入







failure: function(obj1,obj2) {



               if(obj1.statusText == 'communication failure') {



                    var task = new Ext.util.DelayedTask(/*你的ajax code or function*/);



                    task.delay(1);



                }else{



                    alert('請告知管理員伺服器有 : '+obj1.statusText+' 的錯誤');



                }



}



或檢查呼叫的php有無不會顯示訊息的執行錯誤

例如:無限遞迴

2008年2月9日

ExtJS Combobox 的聯動

這就是熬夜的成果!

非常的滿意

也感謝google大神與網路上眾多人的經驗分享

讓小弟的功力更上一層樓 

ps.熬夜真的會傷身阿.... 

以下趕快來分享我的code吧!!! 





//----------------第一個combobox選項----------------------

    faculty_ds=new Ext.data.Store({

        proxy: new Ext.data.ScriptTagProxy({

          url: 'combo_faculty.php'

        }),

        // create reader that reads the Topic records

        reader: new Ext.data.JsonReader({

          root: 'data',

          totalProperty: 'totalCount',

          id: 'faculty_id'

         }, [

          {name: 'faculty_id'},

          {name: 'faculty_name'}

         ]),

   // turn off remote sorting for local sorting

         remoteSort: false

 });

 //----------------------------------------------------

 

 //-------------第二combobox選項-----------------------

 faculty_ch_ds=new Ext.data.Store({

          proxy: new Ext.data.ScriptTagProxy({

                method:'post',

                url: 'combo_ch_faculty.php'

           }),

           autoLoad:'false',

              // create reader that reads the Topic records

          reader: new Ext.data.JsonReader({

             root: 'data',

             totalProperty: 'totalCount',

             id: 'ch_fa_id'

           }, [

             {name: 'ch_fa_id'},

             {name: 'ch_fa_name'}

    ]),

     // turn off remote sorting for local sorting

           remoteSort: false

  });

 //----------------------------------------------------------

 //-----------------------建立第一個combobox------------------

 facombo = new Ext.form.ComboBox({

      fieldLabel: '請選擇xx',

      //disabled:true,

                 name: 'faculty',

                 mode: 'remote',

                 store: faculty_ds,

                 displayField:'faculty_name',

                 valueField:'faculty_id',

                 allowBlank :true,

                 emptyText:'請選擇xx...',

                 typeAhead: true,

                 triggerAction:'all',

                 editable: false,

                 forceSelection: true

    });

 //-------------------------------------------------------

 //----------------------建立第二個combox---------------------------

 ch_fa_combo = new Ext.form.ComboBox({

      //disabled:true,

      fieldLabel: '請選擇xx',

                 name: 'faculty',

                 mode: 'local',

                 store: faculty_ch_ds,

                 displayField:'ch_fa_name',

                 valueField:'ch_fa_id',

                 allowBlank :true,

                 emptyText:'請先選擇xx...',

                 typeAhead: true,

                 triggerAction:'all',

                 editable: false,

      //renderTo:'fa',

                 forceSelection: true

    });

 //---------------------------------------------------------

 

 var testform = new Ext.FormPanel({

  labelWidth: 75, // label settings here cascade unless overridden

        frame:true,

        title: 'xx查詢',

        bodyStyle:'padding:5px 5px 0',

        width: '100%',

        defaults: {width: 230},

        defaultType: 'textfield',

  

  

  items: [{

    id: 'first',

    fieldLabel: 'First Name',

    name: 'first',

    value: 'test',

                allowBlank:false

    },facombo,ch_fa_combo]

 });

 testform.render(Ext.get("tform"));

 

 

 facombo.on('select',ajax_combo);

 

 function ajax_combo(){

  var va = facombo.getValue();

  //alert(va);

  ch_fa_combo.store.reload({params:{ch:va}});

  //faculty_ch_ds.load({params:{ch:va}});

}



大部分code都沒什麼好講的

唯獨我標明紅色的部份是最重要的!

要非常注意

要變動的combobox remote一定要設為local!!

如果設remote

在第一次store.reload的時後會出錯

雖然第二次之後會正常

但是沒有人的網頁是第一次出錯接下來正常的吧~?

卡在這卡了最久....

決定把他記錄下來!

如有說明錯誤歡迎指正