无法使用句柄选择Kendo Sortable中的文本

时间:2014-10-15 23:04:11

标签: jquery kendo-ui selection jquery-ui-sortable textselection

我有一组可排序的小部件,与此demo非常相似。 JS在这里:

    var column1Sortable = $(column1Selector).kendoSortable({
        filter: ".panel",
        cursor: "move",
        handler: ".panel-header",
        connectWith: column2Selector,
        change: sortableOnChange,
        placeholder: sortablePlaceholder,
        hint: sortableHint
    }).data("kendoSortable");
    var column2Sortable = $(column2Selector).kendoSortable({
        filter: ".panel",
        cursor: "move",
        handler: ".panel-header",
        connectWith: column1Selector,
        change: sortableOnChange,
        placeholder: sortablePlaceholder,
        hint: sortableHint
    }).data("kendoSortable");

面板的HTML看起来与此类似:

<div class="panel">
    <div class="panel-header">Header</div>
    <div class="panel-content">
        ... selectable text here ...
    </div>
</div>

虽然我为handler div设置了.panel-header选项,但我无法在.panel-content区域内选择任何文字。鼠标光标显示文本光标,但在尝试突出显示时,没有任何内容突出显示。

1 个答案:

答案 0 :(得分:3)

解决方案是使用ignore选项并使用高级选择器和&#34;选择全部&#34;选择器*。以下是我的JS初始化调用的内容:

    var column1Sortable = $(column1Selector).kendoSortable({
        filter: ".panel",
        cursor: "move",
        handler: ".panel-header",
        ignore: ".panel-contents *",
        connectWith: column2Selector,
        change: sortableOnChange,
        placeholder: sortablePlaceholder,
        hint: sortableHint
    }).data("kendoSortable");
    var column2Sortable = $(column2Selector).kendoSortable({
        filter: ".panel",
        cursor: "move",
        handler: ".panel-header",
        ignore: ".panel-contents *",
        connectWith: column1Selector,
        change: sortableOnChange,
        placeholder: sortablePlaceholder,
        hint: sortableHint
    }).data("kendoSortable");