EasyUI Forum
May 18, 2024, 11:07:23 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Disable drop from modal dialog/window  (Read 10663 times)
Pierre
Sr. Member
****
Posts: 439


View Profile Email
« on: April 27, 2016, 07:05:26 AM »

Hello all
is there any option to disable drop of datagrid or treegrid items from modal window to datagrids below that modal window?
I have window and treegrid on it and I want to be able to use only drag/drop on that window but not outside that (modal) window.
I know for the option to accept drop but I have 4 or more datagrids behind modal window and want to avoid lot of code if possible.
Thank you.
« Last Edit: April 29, 2016, 05:40:32 AM by Pierre » Logged
Pierre
Sr. Member
****
Posts: 439


View Profile Email
« Reply #1 on: April 28, 2016, 06:27:26 AM »

It is bug for me because I'm able to drop selected datagrid item to "through" window (with other words, if another datagrid is behind current window, I can drop a record on it).
Any comments?
Logged
Max Lamda
Newbie
*
Posts: 48


View Profile
« Reply #2 on: April 28, 2016, 06:45:49 AM »

I had the same problem but I do not see it as a bug.


I added a class dropdynamic to all dropable areas and disabled them, when something happens (tabs change or whatever you application does to put content over other content).

Can be done quite easy then with:

$('.dropdynamic').droppable('disable');


Now you only have to enable the dropable area for the content which just popped up.
Logged
Max Lamda
Newbie
*
Posts: 48


View Profile
« Reply #3 on: April 28, 2016, 06:50:21 AM »

In my application it was just two lines of extra-code in the appropriate functions which change the shown area.
Logged
Pierre
Sr. Member
****
Posts: 439


View Profile Email
« Reply #4 on: April 28, 2016, 07:33:28 AM »

OK thank you but do you have some simple example of how you did that?
Thank you again.
Logged
Max Lamda
Newbie
*
Posts: 48


View Profile
« Reply #5 on: April 28, 2016, 07:38:57 AM »

Maybe

$('.dropdynamic').droppable('disable');
$('.dropdynamic').is(':visable').droppable('enable');

already works.

You could use it in the

onBeforeDrag

property of your draggable area....

Logged
Pierre
Sr. Member
****
Posts: 439


View Profile Email
« Reply #6 on: April 28, 2016, 11:30:08 AM »

Hello
I created sample:
http://code.reloado.com/oeasyrik1/6/edit#preview

Attached are 2 images where you can see that I'm using Modal window and I need to avoid to drop outside Grid and to drop on datagrid behind.
Could you please implement your code here:
http://code.reloado.com/oeasyrik1/6/edit#source
(you can then click on "Render" to see result.
Thank you.
Logged
Max Lamda
Newbie
*
Posts: 48


View Profile
« Reply #7 on: April 29, 2016, 01:09:38 AM »


Just add

      dropAccept:'.dlg1',
      rowStyler: function() {
      return {class: 'dlg1'};
      },
to your first datagrid


and


      dropAccept:'.dlg2',
      rowStyler: function() {
      return {class: 'dlg2'};
      },

to your second.


http://code.reloado.com/oeasyrik1/7/edit

Logged
Pierre
Sr. Member
****
Posts: 439


View Profile Email
« Reply #8 on: April 29, 2016, 01:20:30 AM »

Awesome, thank you so much  Grin
Logged
Pierre
Sr. Member
****
Posts: 439


View Profile Email
« Reply #9 on: April 29, 2016, 01:36:37 AM »

Awesome, thank you so much  Grin
OK now I see that you implemented dropAccept and my question was how to disable drop on all grid-s behind current window (I have 4-5 grids and I try to avoid writing dropAccept on all of them..
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!