JSやjQueryに関する深い知識はありません。私が達成しようとしているのは、私が見せてくれる対話が少なく、彼らに共通のルック・アンド・フィールを与えたいということです。私はそれぞれを表示するjs関数を呼び出しています。私は<p:dialog ></p:dialog>
タグでプロパティを設定できることを知っています。しかし、アプリケーションのすべての対話に対処するためにプロパティを設定するモジュール式のアプローチが必要なので、私はこのアプローチを望んでいません。プライムフェイスのダイアログプロパティをJavaスクリプトから設定する
関数定義:
function editPartner(dialog){
dialog.cfg.height = '500px';
dialog.cfg.width = '600px';
dialog.cfg.minHeight = '500px';
dialog.cfg.minWidth = '600px';
dialog.show();
}
そして、それを呼び出す
<p:commandButton id="editButton" oncomplete="editPartner(PF('DialogEditPartner'))" />
からではなく、幅と高さの設定がダイアログに反映されていません。
プライム面component.jsからわずかリファレンス、私は身長と体重 がCFGオブジェクトから設定されて見ることができます。 完全なコード::私は私の答えを編集ANS私の完全なコードを示しコメントに基づい
PrimeFaces.widget.Dialog = PrimeFaces.widget.BaseWidget.extend({
init: function(a) {
this._super(a);
this.content = this.jq.children(".ui-dialog-content");
this.titlebar = this.jq.children(".ui-dialog-titlebar");
this.footer = this.jq.find(".ui-dialog-footer");
this.icons = this.titlebar.children(".ui-dialog-titlebar-icon");
this.closeIcon = this.titlebar.children(".ui-dialog-titlebar-close");
this.minimizeIcon = this.titlebar.children(".ui-dialog-titlebar-minimize");
this.maximizeIcon = this.titlebar.children(".ui-dialog-titlebar-maximize");
this.blockEvents = "focus." + this.id + " mousedown." + this.id + " mouseup." + this.id;
this.resizeNS = "resize." + this.id;
this.cfg.absolutePositioned = this.jq.hasClass("ui-dialog-absolute");
this.cfg.width = this.cfg.width || "auto";
this.cfg.height = this.cfg.height || "auto";
this.cfg.draggable = this.cfg.draggable === false ? false : true;
this.cfg.resizable = this.cfg.resizable === false ? false : true;
this.cfg.minWidth = this.cfg.minWidth || 150;
this.cfg.minHeight = this.cfg.minHeight || this.titlebar.outerHeight();
this.cfg.position = this.cfg.position || "center";
をだからあなたは、いくつかのユーザに応じてサイズを変更できるようにしたいですアクション?それがあなたのアプローチではなく、単にすべてのダイアログサイズの属性を一度に設定したいのであれば、そのためにCSSを使うべきです。 – lastresort
そうですか、多かれ少なかれダイナミックにしたいのです。 –
私が知っている唯一のことは、このようなものです。var header = document.getElementById( "myDialogId"); header.style.width = "1300px"; – pwain