3
我正在做我的應用程序中的一部分,需要一個HTML塊被加載到一個valueCell函數中。Liftweb WiringUI和JQueryUI衝突
我的代碼正在工作,但JQuery沒有完成它的工作,不顯示選項卡。我可以閱讀「Hello world」和標籤名稱,但我沒有標籤佈局。另外,我可以補充一點,如果我刪除了使用Wiring UI(只需在html頁面中使用displayFormOK而不是displayForm),它就可以很好地工作。
這是我的代碼:
片段:
object Menu {
val searchType = ValueCell[Option[SearchType]](Some(Type1))
//I removed some stuff to update the cell
def displayForm = {
WiringUI.apply(searchType)(displayFormAjax)
}
def displayFormOK ={
displayFormAjax(searchType.get)(NodeSeq.Empty)
}
def displayFormAjax(sType: Option[SearchType])(n:NodeSeq):NodeSeq =
{sType match{
case None => <h3> Error on type </h3>
case Some(x) => {x.displayForm}
}}
}
在這裏被選擇表示對象我的性狀
trait SearchType {
val name:String
def displayForm:NodeSeq = {
<div id="tabs">
<ul>
<a href={"#"+name}> {name} </a></li>)}
</ul> ++
<div id={name}>Hello World </div>
</div>
)}
}
在該性狀的代碼是更復雜的,其實我想要生成任意數量的選項卡。
最後,這裏是我的html代碼
<script>
$(function() {
$("#tabs").tabs();
});
</script>
<form class="lift:form.ajax">
<div class="lift:Menu.displayForm"></div>
</form>
您是否在Web瀏覽器中檢查了JavaScript控制檯是否有錯誤? – 2012-01-14 21:09:39
我剛剛檢查過,沒有發生javascript錯誤 – 2012-01-14 22:05:27
我認爲它來源於WiringUI腳本中的「嵌套」選項卡腳本,但我找不到如何很好地使用這些腳本。 – 2012-01-15 08:48:35