schlebe
schlebe

Reputation: 3715

What is 'data-widgetvar' attribute defined in <div> of xhtml Primefaces page

In xhtml Primefaces page, I search to get a widget's reference that represents a specific DialogFrameWork widget.

The problem is that this widget is generated dynamically using some Java code on J2EE JSF server and is not defined directly in xhtml file.

The only solution I see is to inspect the DOM after DialogFrameWork has been loaded.

Primefaces seems to generate a element in DOM.

Using JQuery, I can find this element.

In this element there exist 2 custom attributes that are

  1. data-widgetvar
  2. data-pfdlgcid

What are these attributes ?

Can I use them to get PrimeFaces widget ?

How ?

Upvotes: 0

Views: 495

Answers (1)

tramex
tramex

Reputation: 184

data-widgetvar attribute of DialogFrameWork widget represent a reference and can be used to get widget variable.

example:

 jQuery(".ui-dialog.ui-overlay-visible",window.parent.document)
     .each
         (function(nIndex)
             {
             var sWidgetName = $(this).attr('data-widgetvar');
             var wgDialog = window.parent.PF(sWidgetName);
             wgDialog.hide();
             });

Upvotes: 0

Related Questions