如何在kendo ui中拖放panelbars?

时间:2013-03-07 08:43:01

标签: javascript kendo-ui

在我的项目中,我需要使用图表拖放面板栏,是否可以拖放?如果可能,任何人都可以在剑道ui中提供示例

1 个答案:

答案 0 :(得分:5)

Kendo UI Widget(非官方)可以简化您的开发。

如果您将面板内容定义为:

<div class="panel-container">
    <div class="panel">
        <ul id="panelbar0" class="ob-panel-bar">
            <li class="k-state-active">
                <span class="k-link k-state-selected">Graph #0</span>
                <div><div>Hello, world!</div><div>Hello, world!</div><div>Hello, world!</div></div>
            </li>
        </ul>
        <ul id="panelbar1" class="ob-panel-bar">
            <li class="k-state-active">
                <span class="k-link k-state-selected"> Graph #1</span>
                <div><div>Hello, world!</div><div>Hello, world!</div><div>Hello, world!</div></div>
            </li>
        </ul>
        <ul id="panelbar2" class="ob-panel-bar">
            <li class="k-state-active">
                <span class="k-link k-state-selected"> Graph #2</span>
                <div><div>Hello, world!</div><div>Hello, world!</div><div>Hello, world!</div></div>
        </ul>
        <ul id="panelbar3" class="ob-panel-bar">
            <li class="k-state-active">
                <span class="k-link k-state-selected"> Graph #3</span>
                <div><div>Hello, world!</div><div>Hello, world!</div><div>Hello, world!</div></div>
            </li>
        </ul>
        <ul id="panelbar4" class="ob-panel-bar">
            <li class="k-state-active">
                <span class="k-link k-state-selected"> Graph #4</span>
                <div><div>Hello, world!</div><div>Hello, world!</div><div>Hello, world!</div></div>
            </li>
        </ul>
        <ul id="panelbar5" class="ob-panel-bar">
            <li class="k-state-active">
                <span class="k-link k-state-selected"> Graph #5</span>
                <div><div>Hello, world!</div><div>Hello, world!</div><div>Hello, world!</div></div>
            </li>
        </ul>
    </div>
</div>

以及用于初始化面板的以下JavaScript:

$("#panelbar0").kendoPanelBar({
    expandMode: "multiple"
});
$("#panelbar1").kendoPanelBar({
    expandMode: "multiple"
});
$("#panelbar2").kendoPanelBar({
    expandMode: "multiple"
});
$("#panelbar3").kendoPanelBar({
    expandMode: "multiple"
});
$("#panelbar4").kendoPanelBar({
    expandMode: "multiple"
});
$("#panelbar5").kendoPanelBar({
    expandMode: "multiple"
});

你只需要添加:

$(".panel-container").kendoOBSortableGrid({
    hint: function (element) {
        return element.clone().addClass("ob-being-dragged");
    }
});

在此处查看演示:http://jsfiddle.net/OnaBai/WxUUL/