锚点在 mootools 中不起作用

发布于 2024-12-06 21:18:21 字数 232 浏览 0 评论 0原文

我使用 mootools sortables 创建了一个表来实现拖放功能。 在我的表格中,某些列有超链接和文本框。当我单击超链接/输入框时,它总是调用 Sortable 的回调,例如 onComplete。

如何使超链接/输入元素在 Sortable 中工作。我尝试使用 Sortable 的句柄属性,但此属性的问题是它只需要一个元素。如果我必须使用行的多列作为句柄,那么我需要什么该怎么办?我还有希望吗?

提前致谢。

I have created a table using mootools sortables to implement drag and drop functionality.
Inside my table some of the columns has hyperlink and textboxes.When I click on hyperlink/input box it always calls Sortable's callback like onComplete.

How do I make hyperlink/input Elements working inside Sortable.I have tried to use handle property of Sortable but problem with this property is that it takes only one element.If I have to use multiple columns of of row as handle then what I need to do ?Do I have any hope ?

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

沩ん囻菔务 2024-12-13 21:18:21

事实并非如此,您只能使用一个元素作为句柄。您可以使用 handle 选项中的 CSS 选择器来指定句柄。然后,这指的是相对于“可排序”(要排序的元素)。

因此,假设在您的可排序项(如

  • html 元素)中,您的句柄是一个 ,其类为 my-handle,你可以这样做:
  • var mySortables = new Sortables('#list-1', {
        handle: '.my-handle'
    });
    

    我认为这样解决它更简洁,而不是停止你一开始不想要的事件的事件传播。

    It's not true you can only use one element as a handle. You can specify a handle by using CSS selectors in the handle option. This then refers relative to the 'sortable' (the element to be sorted).

    So suppose within your sortable item (like an <li> html element) your handle is a <span> with the class my-handle, you could do:

    var mySortables = new Sortables('#list-1', {
        handle: '.my-handle'
    });
    

    I think it's neater to solve it like that, instead of stopping event propagation of events you didn't want in the first place.

    小情绪 2024-12-13 21:18:21

    我通过在 domready 中添加以下代码来防止事件冒泡来解决该问题。

        document.getElements("a").addEvents({
            click: function(e) {
                if (!e) var e = window.event;
                    e.cancelBubble = true;
                if (e.stopPropagation) 
                    e.stopPropagation();
            }
        });
    

    I was able to solve the problem by adding following code in domready to prevent event bubbling.

        document.getElements("a").addEvents({
            click: function(e) {
                if (!e) var e = window.event;
                    e.cancelBubble = true;
                if (e.stopPropagation) 
                    e.stopPropagation();
            }
        });
    
    ~没有更多了~
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文