2014-06-28 29 views
1

我有一個模板文件,它具有頂部,左側,右側,中間和底部佈局部分。在我的一個.xhtml頁面中,我包含了我的模板ui:composition template =「template」,並定義了我的頁面的左側和中間部分。左邊部分是一個菜單,其中有兩個項目可以改變頁面中心部分的內容。中心部分是一個面板,裏面有2個面板,所以當我點擊它選擇顯示其中一個子面板的菜單項時,面板有一個id =「panel1」。 Menuitem的action =「#{bean.setpanel(1或2)}」update =「panel1」,但它不起作用,因爲它們不在同一個「空間」中。我無法弄清楚如何從左側菜單調用中心的panel1 - 我如何計算出該元素id的完整路徑(main:bla:bla:panel1或者像這樣的smth),如果我做了如何操作弄清楚如何從不同的「空間」調用該元素。如何在JSF Primefaces中獲得完整的元素ID(ID爲路徑)

回答

-1

檢查一下,看看它是否你需要..如果你需要關於代碼的解釋,請詢問。

var path = $(this) 
     .parentsUntil('body') //target parent 
     .andSelf() //include this element in the following string array 
     .map(function() { //build an array out of the results in the provided format 
     return this.nodeName + ':eq(' + $(this).index() + ')'; 
     }).get().join('>'); //put it into string and between each result add '>' 
+0

@BalusC還添加了關於它的代碼註釋。爲你。 –

+0

@BalusC我明白了,但如果我犯了一個錯誤,他可以告訴。 仍然不認爲是一個關於它的作品。 –

相關問題