Jump to content

Drag and drop cells between 2 Stringgrids


rhennink

Recommended Posts

Hello @rhennink

Sorry, we had an unfinished post about this before:

 

So here's the solution for you (simple implementation):

1. 

initialization
  UniAddCSSLibrary('build/packages/ux/classic/classic/resources/ux-all.css', False, [upoFolderJS, upoPlatformDesktop]);
  UniAddJSLibrary('build/packages/ux/classic/ux.js', False, [upoFolderJS, upoPlatformDesktop]);

2. First StringGrid.ClientEvents.UniEvents ->

function beforeInit(sender, config) 
{
    config.viewConfig = {
        plugins: {
            ptype: 'celldragdrop',

            ddGroup: "StringGridDD",

            // remove text from source cell and replace with value of emptyText
            applyEmptyText: false,

            dropBackgroundColor: Ext.themeName === 'neptune' ? '#a4ce6c' : 'green',

            noDropBackgroundColor: Ext.themeName === 'neptune' ? '#d86f5d' : 'red',

            // will only allow drops of the same type
            enforceType: true,

            enableDrop: false,

            enableDrag: true,
        }
    }
}

3. Second StringGrid.ClientEvents.UniEvents ->

function beforeInit(sender, config) 
{
    config.viewConfig = {
        plugins: {
            ptype: 'celldragdrop',

            ddGroup: "StringGridDD",

            // remove text from source cell and replace with value of emptyText
            applyEmptyText: false,

            dropBackgroundColor: Ext.themeName === 'neptune' ? '#a4ce6c' : 'green',

            noDropBackgroundColor: Ext.themeName === 'neptune' ? '#d86f5d' : 'red',

            // will only allow drops of the same type
            enforceType: true,

            enableDrop: true,

            enableDrag: false,
        }
    }
}

 

Link to comment
Share on other sites

Hi Sherzod,

this is really great!!!, and my test-project is really working great!!!! THNX!

can you help me with one simple thing?

I would like to see which cell has moved from the source-position/grid to the new position/grid. Then I can create some logic in my code to do some data-processing.

 

thnx!!!

RIchard

Link to comment
Share on other sites

10 minutes ago, rhennink said:

I would like to see which cell has moved from the source-position/grid to the new position/grid. Then I can create some logic in my code to do some data-processing.

I will try to check.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...