非常新的表面,所以请原谅我,如果它很容易。
因为我想在下拉列表中更改值时清除自动填充文本框。
在我的xhtml页面中,当我从下拉列表中选择公司时,与该国家相关联的银行将会到来。当我拿到银行时,与该银行相关联的分行将进入下一个自动完成字段。这工作正常。
但是当我下一个国家时,自动填充字段没有被清除。
请帮我解决这个问题。
此div是国家/地区的下拉列表
Or
此div用于银行的自动填充
<div class="row" >
<div class="grid4 bordered-box">
<p:outputLabel styleClass="col4 mandatory-field" value="#{msg['Label.CountryList']}" />
<div class="col5">
<p:selectOneMenu id="countryList" style="width: 10px ; border:1px #DDDBDB solid ;background-color: #F4EDC1;" filter="true" filterMatchMode="startsWith" required="true"
value="#{bankBranchController.bankBranchDetails.countryCode}">
<p:ajax process="@this" update="bankDD" />
<f:selectItems
value="#{bankBranchController.countryList}"
var="item" itemLabel="#{item.label}"
itemValue="#{item.value}" />
<f:selectItems/>
</p:selectOneMenu>
</div>
</div>
</div>
此div用于分支
的自动完成<div class="grid4 bordered-box">
<p:outputLabel styleClass="col4 mandatory-field" value=" Bank " />
<div class="col5">
<p:autoComplete id="bankDD" minQueryLength="3" value="#{bankBranchController.bankBranchDetails.bankName}" completeMethod="#{bankBranchController.getBankListAutoComplete}"
var="varItem" itemLabel="#{varItem.label}" itemValue="#{varItem.value}" scrollHeight="120" >
<p:ajax event="itemSelect" update="branchDD"></p:ajax>
</p:autoComplete>
</div>
</div>
答案 0 :(得分:0)
您应该在<DataTemplate>
<Grid Margin="12,2,5,4" >
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Rectangle Fill="{StaticResource PhoneAccentBrush}"
Opacity="0.75"
Margin="0,0"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"/>
<Grid Grid.Row="0"
Background="Transparent"
Height="auto"
MinHeight="99">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="99"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid HorizontalAlignment="Center"
Background="#FFFFC700">
<Image Source="{Binding ImageUrl}"
Height="auto"
Width="auto"
Stretch="UniformToFill"
Margin="0"
HorizontalAlignment="Center"
VerticalAlignment="Stretch">
</Image>
</Grid>
<Grid Width="311" Margin="8,-7,0,0" Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Margin="10,15,15,0" Text="{Binding Content}" Style="{StaticResource NewsFeedHighlitedContent}" FontSize="24" />
<Grid Margin="10,5,0,15" Visibility="{Binding StarsVisibility}" Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30" />
<ColumnDefinition Width="30" />
<ColumnDefinition Width="30" />
<ColumnDefinition Width="30" />
<ColumnDefinition Width="30" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<Image Source="{Binding StarOne}" Height="30" Margin="0,0" Width="30" Stretch="UniformToFill" Grid.Row="0" Grid.Column="0" />
<Image Source="{Binding StarTwo}" Height="30" Width="30" Stretch="UniformToFill" Grid.Row="0" Grid.Column="1" />
<Image Source="{Binding StarThree}" Height="30" Width="30" Stretch="UniformToFill" Grid.Row="0" Grid.Column="2" />
<Image Source="{Binding StarFour}" Height="30" Width="30" Stretch="UniformToFill" Grid.Row="0" Grid.Column="3" />
<Image Source="{Binding StarFive}" Height="30" Width="30" Stretch="UniformToFill" Grid.Row="0" Grid.Column="4" />
</Grid>
<TextBlock Text="{Binding Time}" Margin="8,14,25,7" Grid.Row="2" VerticalAlignment="Bottom" Style="{StaticResource NewsTimeAgoStyle}" />
</Grid>
</Grid>
</Grid>
</DataTemplate>
中添加侦听器方法,在该方法中,您应该<p:ajax process="@this" update="bankDD" />
甚至bankBranchDetails.setBankName("")
,无论如何都应该清除它。