2011-08-22 97 views
0

我已富含延伸的面数据表中的行以下数据,扩展数据表和模式面板

加入日期,注释,用户,修改日期等

当项目被填充用户将能够编辑特定的东西,如笔记字段。

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

有什么建议吗?

继承人为特定列的代码,请注意这是一个多A4J:形式

<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> 

所以你需要它在原始形式之外。

其次,您需要在打开的动作中重新调用模态面板。我所做的是使用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 so例如。

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> 
+0

什么是errInfo.statusNotes和selectedErrorInfo.errorId?你可以给更多的源代码(数据表)? –

+0

selectedErrorInfo实际上是DataModelSelection – Kevin

+0

和errInfo只是var,它包含状态说明 – Kevin

回答

1

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

在这种情况下(我认为是这样),问题是所有的模态面板都有相同的ID(statusNotesPanel)。 尝试连接statusNotesPanelerrInfo.errorId作为rich:modalPanel的ID。

+0

如果没有在数据表中声明,你可以给更多的源代码吗? –

+0

对不起,我还在试图找出解决这个问题的方法。我会尝试更多的事情。我觉得我很接近。 – Kevin

+0

好吧,我明白了。我会在编辑中发布答案。非常感谢牛仔! – Kevin