扩展数据表和模态面板

时间:2011-08-22 15:25:51

标签: richfaces

我有一个富表面扩展数据表,以下数据为行,

添加日期,备注,用户,更改日期等。

当填充项目时,用户将能够编辑特定的内容,例如备注字段。

我有一个带有该注释字段的commandButton,它会弹出一个富脸模态面板,但由于某些原因我的模态面板没有检索到正确的行。而是它总是返回扩展数据表的第一行

有什么建议吗?

下面是特定列的代码,请注意它是在a4j:form

<a4j:commandButton value="Edit Status Notes" rendered="#{selectedErrorInfo.errorId == errInfo.errorId}" 
                                         oncomplete="Richfaces.showModalPanel('statusNotesPanel', {width: 350, top: 150});" >


                                    </a4j:commandButton>
                                        <rich:modalPanel id="statusNotesPanel">                                     
                                            <center>
                                            <h:inputTextarea value="#{errInfo.statusNotes}" style="height:100px; width:300px;" maxlength="4000"/>
                                            <br/>                                           
                                            <a4j:commandButton value="Close" oncomplete="Richfaces.hideModalPanel('statusNotesPanel');" />
                                            </center>                                           
                                        </rich:modalPanel>  

答案

好的,好几件事。 首先,模态面板不能采用原始数据表的形式。这样的例子是

<h:form>
 <rich:ExtendedDatatable>
  ...... info here (if there is any ModalPanel within this area with forms, it will not work
 </rich?:ExtendedDataTable>
</h:form>

所以你需要在原始表格之外。

其次,你需要在开启动作上重新调整modalPanel。我所做的是使用commandButton并将reRender =设置为modalPanel表单的id。例如:

<rich:commandButton reRender="blah"  oncomplete="Richfaces.showModalPanel('blah', {width: 350, top: 150});">

<rich:modalPanel id= "blah">

第三,我使用DataModelSelection让ajax做我所有的选择。 你必须说,为了使用它是

class.SelectedItem.property 所以在例子中。

public class TestClass
{

 @DataModel
 List<Person> testItems;

 @DataModelSelection("testItems")
 Person selectedlistItem;
}

public class person
{

 String name;
 String lastName;

 //getters setters etc.
}

在XHTML中你需要。

<rich:modalPanel>
<h:form>
 <h:inputText value="#{TestClass.selectedListItem.name}"/> in order to retrieve the name 
</h:form>

1 个答案:

答案 0 :(得分:1)

你的modalPanel是否在数据表的迭代中声明了?

在这种情况下(我认为是这样),问题是你的所有modalPanel都具有相同的id(statusNotesPanel)。 尝试将statusNotesPanelerrInfo.errorId连接为rich:modalPanel的id。

相关问题