Extjs4 implements the data dragging function between two gridpanels

Source: Internet
Author: User

1. I have seen on winForm that some data will be placed in the to-be-selected box when selecting data, and you can put the data you want to select in the alternative box, so how to use Extjs to implement similar functions, we choose to use two gridpanels to simulate the alternative box and the waiting box. As shown in:

 

The definition code is as follows:

{
Xtype: 'gridpanel ',
MultiSelect: true,
Id: 'staff ',
X: 5,
Y: 0,
Height: 205,
Width: 260,
ViewConfig :{
Plugins :{
Ptype: 'gridviewdragdrop ',
DragGroup: 'firstgridddgroup ',
DropGroup: 'secondgridddgroup'
},
Listeners :{
Drop: function (node, data, dropRec, dropPosition ){
Var dropOn = dropRec? ''+ DropPosition +'' + dropRec. get ('name'): 'On empty view ';
}
} Www.2cto.com
},
Store: StaffData, // store for loading data
Columns: columns,
StripeRows: true,
Title: 'practitioners ',
Margins: '0 2 0 0'
},
{
Xtype: 'gridpanel ',
Id: 'admin ',
X: 280,
Y: 0,
Height: 205,
Width: 260,
ViewConfig :{
Plugins :{
Ptype: 'gridviewdragdrop ',
DragGroup: 'secondgridddgroup ',
DropGroup: 'firstgridddgroup'
},
Listeners :{
Drop: function (node, data, dropRec, dropPosition ){
Var dropOn = dropRec? ''+ DropPosition +'' + dropRec. get ('name'): 'On empty view ';
}
}
},
Store: AdminData,
Columns: columns,
StripeRows: true,
Title: 'postmaster ',
Margins: '0 0 0 3'
}

In this way, you can store the data in the corresponding store during drag and drop operations, and retrieve the data from the store as needed.

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.