Notice: The Monaca & Onsen UI Community Forum is shutting down.
For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.
Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.
Problems in Drag & Drop while moving to Onsen 2
-
@Fran-Diox ah…ok, very clear. Thank you. This will work as we are going to switch off gesture on one specific page where drag and drop is required.
Just one quick question (probably a last one on this :blush:). Unlike document body, gesture detector couldn’t be reactivated for splitter. I tried reactivating it by assigning new ons.GestureDetector(…) to variable name, document.querySelector(‘ons-splitter-side’), document.getElementById (…) but none of them worked. (demo updated)
Once disabled, I couldn’t again get swipe menu activated. I saw in documentations that ons.GestureDetector has optional options parameter. Do we need to use any specific option in case of splitter?
Regards,
CNaik.
-
@CNaik Oh yes, I forgot about that, sorry. You need to pass the parent element as a parameter. Something like this:
splitterSide._gestureDetector = new GestureDetector(splitterSide.parentElement, {dragMinDistance: 1});
-
@Fran-Diox unfortunately it didn’t solve the problem (demo updated). May be any other required options missing?
One thing I noticed that for dispose and create statements, I had to use variable name specified in id attribute in HTML. Normally we use variable specified with var attribute. Which is not working in this case. I guess this might be very normal. But I noticed this for first time and hence bringing into your notice if it’s something new.
Regards,
CNaik.
-
@CNaik One more thing, it needs to refresh the
swipeable
attribute in order to listen for the events again. The easiest way is to remove it and set it again. Updated here: http://codepen.io/frankdiox/pen/RaQpQQAbout using
var
attribute or not…var
is only for Angular stuff. Here we are modifying the core so we need to use the real components. Normally you would need to dodocument.querySeletor('#splMenu');
to access the component. However, due to some hidden feature of HTML (not in Onsen), global variables are created for every ID so technically you can usesplMenu
with the same result. For example, you can access to<div id="myDiv"></div>
withwindow.myDiv
. This is quite error prone and I’d say it’s not recommended.
-
@Fran-Diox it’s working perfectly now. Thank you for your valuable input.
We will avoid using global variables.
Regards,
CNaik.