Grid drag-and-drop instance code for rows

Source: Internet
Author: User
Tags sort
This article introduces the grid drag-and-drop line instance code, the need for friends can refer to

---------------------Grid Drag-and-drop the instance code for the row to drag---------------------------------------

Copy Code code as follows:


Create the first grid
var firstgrid = new Ext.grid.GridPanel ({
Ddgroup: ' Secondgridddgroup ',//Here is the second grid of Ddgroup
Store:firstgridstore,
Enabledragdrop:true,//true indicates that the drag behavior of the selected row in the Gridpanel is initiated
...... Other properties omitted
});

Create a second grid
var secondgrid = new Ext.grid.GridPanel ({
Ddgroup: ' Firstgridddgroup ',//This is the first grid Ddgroup
Store:secondgridstore,
Enabledragdrop:true,//true indicates that the drag behavior of the selected row in the Gridpanel is initiated
...... Other properties omitted
});

//Create the first grid Ddgroup
var Firstgriddroptargetel = Firstgrid.getview (). El.dom.childnodes[0].childnodes[1];
var firstgriddroptarget = new Ext.dd.DropTarget (Firstgriddroptargetel, {
ddgroup   : ' Firstgridddgroup ',//Ddgroup same as the second grid
copy       : True,
Notifydrop: function (Ddsource, E, data) {
   function addrow (record, index, allitems) {
    var found Item = Secondgridstore.find (' name ', record.data.name);
    if (Founditem = 1) {
     firstgridstore.add (record);
      firstgridstore.sort (' name ', ' ASC ');
     DdSource.grid.store.remove (record);
   }
  }
   Ext.each (ddSource.dragData.selections, AddRow);
   return (true);
}
)};

//Create a second grid of Ddgroup
var Secondgriddroptargetel = Secondgrid.getview (). El.dom.childnodes[0].childnodes[1];
var secondgriddroptarget = new Ext.dd.DropTarget (secondgriddroptargetel,{
Ddgroup: ' Secondgridddgroup ',// Same as the first grid Ddgroup
copy       : True,
Notifydrop:function (Ddsource, E, Data) {
   function addrow (record, index, allitems) {
    var founditem = Secondgridstore . Find (' name ', record.data.name);
    if (Founditem = 1) {
     secondgridstore.add (record);
      secondgridstore.sort (' name ', ' ASC ');
     DdSource.grid.store.remove (record);
   }
  }
   Ext.each (ddSource.dragData.selections, AddRow);
   return (true);
}
});

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.