Jsf 2 如何在不设置面板标题的情况下使p:仪表板组件可拖动

Jsf 2 如何在不设置面板标题的情况下使p:仪表板组件可拖动,jsf-2,primefaces,panel,dashboard,Jsf 2,Primefaces,Panel,Dashboard,作为后续行动。如果父面板具有标题集(其中包含标题),则显示p:dashboard中的组件仅可拖动。如何使面板即使未设置标题也可以拖动?因此,整个面板将是拖动它的手柄,而不仅仅是标题 XHTML Kukeltje是对的,基本上它归结为在JSPrimeFaces.widget.Dashboardinit函数中硬编码的handle属性。我使用相同的代码创建了自己的javascript文件,但没有设置handle属性,然后使用h:outputScript将该脚本包含在h:body之后 下面是javasc

作为后续行动。如果父面板具有标题集(其中包含标题),则显示
p:dashboard
中的组件仅可拖动。如何使面板即使未设置标题也可以拖动?因此,整个面板将是拖动它的手柄,而不仅仅是标题

XHTML


Kukeltje是对的,基本上它归结为在JS
PrimeFaces.widget.Dashboard
init
函数中硬编码的
handle
属性。我使用相同的代码创建了自己的javascript文件,但没有设置handle属性,然后使用
h:outputScript
将该脚本包含在
h:body
之后

下面是javascript

PrimeFaces.widget.Dashboard = PrimeFaces.widget.BaseWidget
        .extend({
            init : function(b) {
                this._super(b);
                this.cfg.connectWith = this.jqId + " .ui-dashboard-column";
                this.cfg.placeholder = "ui-state-hover";
                this.cfg.forcePlaceholderSize = true;
                this.cfg.revert = false;

                var a = this;
                if (this.cfg.behaviors) {
                    var c = this.cfg.behaviors.reorder;
                    if (c) {
                        this.cfg.update = function(h, g) {
                            if (this === g.item.parent()[0]) {
                                var f = g.item.parent().children().filter(
                                        ":not(script):visible").index(g.item), i = g.item
                                        .parent().parent().children().index(
                                                g.item.parent());
                                var d = {
                                    params : [ {
                                        name : a.id + "_reordered",
                                        value : true
                                    }, {
                                        name : a.id + "_widgetId",
                                        value : g.item.attr("id")
                                    }, {
                                        name : a.id + "_itemIndex",
                                        value : f
                                    }, {
                                        name : a.id + "_receiverColumnIndex",
                                        value : i
                                    } ]
                                };
                                if (g.sender) {
                                    d.params.push({
                                        name : a.id + "_senderColumnIndex",
                                        value : g.sender.parent().children()
                                                .index(g.sender)
                                    })
                                }
                                c.call(a, d)
                            }
                        }
                    }
                }
                $(this.jqId + " .ui-dashboard-column").sortable(this.cfg)
            }
        });
以及XHTML的相关部分

<h:body>
    <h:outputScript library="js" name="pfaces.js" />
    ...
</h:body>

...

解决方案:查看PrimeFaces源代码并调整它。。。
PrimeFaces.widget.Dashboard = PrimeFaces.widget.BaseWidget
        .extend({
            init : function(b) {
                this._super(b);
                this.cfg.connectWith = this.jqId + " .ui-dashboard-column";
                this.cfg.placeholder = "ui-state-hover";
                this.cfg.forcePlaceholderSize = true;
                this.cfg.revert = false;

                var a = this;
                if (this.cfg.behaviors) {
                    var c = this.cfg.behaviors.reorder;
                    if (c) {
                        this.cfg.update = function(h, g) {
                            if (this === g.item.parent()[0]) {
                                var f = g.item.parent().children().filter(
                                        ":not(script):visible").index(g.item), i = g.item
                                        .parent().parent().children().index(
                                                g.item.parent());
                                var d = {
                                    params : [ {
                                        name : a.id + "_reordered",
                                        value : true
                                    }, {
                                        name : a.id + "_widgetId",
                                        value : g.item.attr("id")
                                    }, {
                                        name : a.id + "_itemIndex",
                                        value : f
                                    }, {
                                        name : a.id + "_receiverColumnIndex",
                                        value : i
                                    } ]
                                };
                                if (g.sender) {
                                    d.params.push({
                                        name : a.id + "_senderColumnIndex",
                                        value : g.sender.parent().children()
                                                .index(g.sender)
                                    })
                                }
                                c.call(a, d)
                            }
                        }
                    }
                }
                $(this.jqId + " .ui-dashboard-column").sortable(this.cfg)
            }
        });
<h:body>
    <h:outputScript library="js" name="pfaces.js" />
    ...
</h:body>