检查表列是否有空单元格 [英] check if table column has empty cell
问题描述
在我的情况下,我有3列,每列都取决于上一列. 用户必须输入第1列中的所有单元格,以便第2列可编辑,然后他输入第2列以使第3列可编辑. 如果他清除了单元格,则应禁用从属列.
in my case i have 3 columns, every column is dependent on previous one. user must enter all cells in column 1 so column 2 be editable then he enters column 2 to make column 3 editable. if he cleared cell then dependent columns should be disabled.
我如何使用JavaScript处理它
how could i handle it using JavaScript
请在下面的图片中查找:
please find below image :
推荐答案
我假设您的表单元格将是af:input text
.
您不需要显式的JS来实现此目的,因为您可以在ADF本身中实现它.因此,如果您不需要在JS中执行此操作,则可以按以下方式尝试此操作.有了Button,我们有了action
或actionListener
,就像我们拥有valueChangeListener
和inputText
一样.
I am assuming your table cell will be a af:input text
.
You don't need explicitly JS to achieve this as you can achieve it in ADF itself. So if you dont have requirement to do it in JS then you can try this below way. With Button we are having action
or actionListener
, same way we have valueChangeListener
with inputText
.
假设您有2个输入文本(表中2个单元格).
Suppose you are having 2 input text (2 cells in table).
<af:inputText value="#{bindings.ESal.inputValue}"
label="#{bindings.ESal.hints.label}"
required="#{bindings.ESal.hints.mandatory}"
columns="#{bindings.ESal.hints.displayWidth}"
maximumLength="#{bindings.ESal.hints.precision}"
shortDesc="#{bindings.ESal.hints.tooltip}" id="it11"
autoSubmit="true" valueChangeListener="#{bean1.textChange}"
>
<f:validator binding="#{bindings.ESal.validator}" />
</af:inputText>
- 在这里输入
autoSubmit = true
作为输入文本 改变了. -
使用valueChangeListener事件并以
textChange
的方式创建方法 如上所示.只要您的输入文本发生更改,就会触发该事件(在选项卡上也将发生更改).- Here make
autoSubmit = true
for the input text which will be changed. Use valueChangeListener event and create a method as
textChange
as shown above. It will be triggered whenever there is a change in your input text (on tab change also it will be triggered).<af:inputText label="Output label" id="ol1" partialTriggers="it11" binding="#{bean1.lbl}" disabled="true"/>
-
此inputText依赖于第一个.默认情况下它是禁用的.
This inputText is dependent on first one. It's disabled by default.
为此inputText创建一个绑定,该绑定可用于托管 豆.
Create a binding for this inputText which can be used in managed bean.
public void textChange(ValueChangeEvent valueChangeEvent) { // Add event code here... if(!(valueChangeEvent.getNewValue()==null || valueChangeEvent.getNewValue().equals(""))) // checking input Text value { // if not null lbl.setDisabled(false); //then enable it AdfFacesContext adfFacesContext = AdfFacesContext.getCurrentInstance(); adfFacesContext.addPartialTarget(lbl); // refresh the binding } else { lbl.setDisabled(true); //else disable it. AdfFacesContext adfFacesContext = AdfFacesContext.getCurrentInstance(); adfFacesContext.addPartialTarget(lbl); }
}
这篇关于检查表列是否有空单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
- Here make