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

沒有留言:

張貼留言