我已安裝最新版本的Domino上運行的最新擴展庫。我正在使用一個簡單的列表框與來自DBColumn(它的工作來填充列表框)的值。嘗試使用Select2獲取列表框的值
但是,我似乎無法獲得listBox的選定值。我在網絡上打了一會兒,發現了幾個不同的東西,我嘗試過的不成功。然後我開始閱讀有關安裝其他庫等現在我感到困惑。以下是我的代碼。我想要做的就是從列表框中獲取選定的值,但我真的想使用select2功能來搜索列表框。有人能指出我在正確的方向上如何在選擇值變化時獲得選定的值嗎?
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:bx="http://www.openntf.org/xsp/bootstrap">
<xp:scriptBlock id="scriptBlock2">
<xp:this.value>
<![CDATA[
$(document).ready(
function() { x$("#{id:listBoxProperties}").select2()
.on("change", function(e) { XSP.partialRefreshPost(
"#{id:computedField2}");
}
}
);
]]>
</xp:this.value>
</xp:scriptBlock>
<xp:panel>
<xp:listBox id="listBoxProperties" value="#{viewScope.selectedProperty}"
style="width:250px">
<xp:selectItems>
<xp:this.value><![CDATA[#{javascript:listOfProperties = @DbColumn(@DbName(), 'vwAuditDocsByPropertyNo', 1);
if(@IsError(listOfProperties))
"Error looking up properties: " + listOfProperties;
listOfProperties;
}]]></xp:this.value>
</xp:selectItems>
<xp:eventHandler event="onchange" submit="true"
refreshMode="complete">
</xp:eventHandler></xp:listBox>
<bx:select2PickerCombo id="select2Property"
for="listBoxProperties" placeHolder="-Select a Property-"
binding="#{javascript:viewScope.selectedProperty}">
</bx:select2PickerCombo>
<xp:br></xp:br>
<xp:text escape="true" id="computedField1"
value="#{javascript:viewScope.selectedProperty;}">
</xp:text>
<xp:text escape="true" id="computedField2">
<xp:this.value><![CDATA[#{javascript:getComponent("listBoxProperties").getValue()}]]></xp:this.value>
</xp:text>
</xp:panel>
</xp:view>
您是否試圖從客戶端或服務器端獲取值? –
好問題。我想設置一個viewscope var,它將在用戶從列表框 – Bitwyse1