1
私は隠しテーブルを部分的にリフレッシュするコンボボックスを持っています。デフォルト値以外の値が選択されると、テーブルを表示しようとしています。私は、表のレンダリングを制御するかどうかをスコープ変数にバインドされた隠し編集フィールドを使用しています。私は、スコープ変数が設定される前に部分的なリフレッシュを最初にやっているというコードがあることを信じています(onCompleteのコードを参照してください)。しかし、リフレッシュが発生する前にスコープ変数を最初に設定する方法が不明です。誰かが私を正しい方向に向けることができますか?一部のページの更新中にエラーが発生しました
<xp:comboBox id="vendorAppAdvSkills1">
<xp:selectItem itemLabel="-Select a Category-"
itemValue="" id="selectItem1">
</xp:selectItem>
<xp:selectItems id="selectItems1">
<xp:this.value><![CDATA[#{javascript:getComponent("vendorAppSkills1").getValue();}]]></xp:this.value>
</xp:selectItems>
<xp:eventHandler event="onblur" submit="false"
id="eventHandler1">
<xp:this.script><![CDATA[
XSP.partialRefreshPost("#{id:tblAdvertising}",
{
// Added showAdvertising code to hide the advertising table until the user selects their free category!
onComplete: function()
{
// Fetch a handle to the first category field
var freeCategory = dojo.byId('#{id:vendorAppAdvSkills1}');
var showAdvertising = document.getElementById('#{id:showAdvertising}');
// If it's blank, force the cursor off the field to fire the onBlur Event
if(freeCategory.value == "" || freeCategory.value == null)
{
if($('body').scrollTop()>0)
{
$('body').scrollTop(0); //Chrome,Safari
}
else
{
if($('html').scrollTop()>0)
{ //IE, FF
$('html').scrollTop(0);
}
}
showAdvertising.value = false;
// Notify the user this is required
alert("Please Select Your FREE Category Listing!");
// Place the cursor back in the first category field again
freeCategory.focus();
}
else
showAdvertising.value = true;
}
});]]></xp:this.script>
</xp:eventHandler>
</xp:comboBox>
NEW CODEは、代わりにXSP.partialRefreshPost
で部分的にリフレッシュを行うのHERE
<xp:comboBox id="vendorAppAdvSkills1">
<xp:selectItem itemLabel="-Select a Category-"
itemValue="" id="selectItem1">
</xp:selectItem>
<xp:selectItems id="selectItems1">
<xp:this.value><![CDATA[#{javascript:getComponent("vendorAppSkills1").getValue();}]]></xp:this.value>
</xp:selectItems>
<xp:eventHandler event="onblur" submit="true" refreshMode="partial" refreshId="tblAdvertising"
onComplete="alert('ssjs code done')">
<xp:this.script><![CDATA[#{javascript:
var vendorAppSkills = getComponent("vendorAppSkills1").getValue();
print("vendorAppSkills: " + vendorAppSkills);
print("typeof vendorAppSkills: " + typeof vendorAppSkills);
if(typeof vendorAppSkills == "java.util.Vector")
{
if(vendorAppSkills.contains("-Select a Category-"))
viewScope.put("showAdvertising", false);
}
else
{
if(typeof(vendorAppSkills == "String"))
if(vendorAppSkills.equalsIgnoreCase("-Select a Category-"))
viewScope.put("showAdvertising", false);
else
viewScope.put("showAdvertising", true);
}
}]]></xp:this.script>
あなたが言ったことを実装しようとしましたが、同じエラーが発生しました:( 新しいコードを見て、間違っているとわかったら教えてください。 – Bitwyse1
また、私のprintステートメントは、リフレッシュではなく読み込み時にのみ実行されることに気づきました。 – Bitwyse1
サーバサイドのコードはすべて、タグではなく、 'でなければなりません。私の例の構文を使って試してみてください。 '<![CDATA [#{javascript:' –
jpishko