Simplica

ProductsLearnPurchaseSupportDemoDownload
  [Search] Search   [Recent Topics] Recent Topics  
GridTable implementation
Forum Index -> DataTable
Author Message
cobar


Joined: 08/01/2007 17:02:58
Messages: 98
Offline

I am having problems with the gridtable not updating a POJO object in the bound dataModel. I have even implemented the onendedit and manually called the setter on the object but when I persist the list of objects in the table not one of the values entered have been captured. Its as if the gridCell is updating a new instance of the data. Gridtable binds ArrayList<POJO> gridTd id="#{ROW.attr}" does not set value in POJO. Adding facet with selectOneMenu value=#{ROW.attr}" does not set value in POJO. gridTd onendEdit=#{bean.setManually}" does not set the value.
adina_mihai
Simplica Team

Joined: 04/01/2007 00:00:00
Messages: 189
Offline

Please add a code snippet with jsp and java code, so I could see exactly how did you bind the dataModel to gridTable, because I suspect that your problem might be a .jsp one. BTW: here's an example using a facet:



Observe that you have to bind value for both gridTd and selectOneMenu.
cobar


Joined: 08/01/2007 17:02:58
Messages: 98
Offline

Is there any way to obtain only rows that have been modified once the user submits the form requesting changes be persisted?

ArrayList<ChildPojo> childList;

model = new WrappedDataModel(new ListDataModel(parentPojo.getChildList()));

<e:gridtable id="gList"
align="center"
rendered="#{bean.renderDetail}"
dataModel="#{bean.model}"
binding="#{bean.table}"
headerStyle="dataTableHeader"
fixedColumnCount="0"
innerBorder="1"

pageSize="-1"
editStyle="fieldInput"
minRows="1"
rendersChildren="true"
style="Filter: Gray; border-width: 1px; border-style: solid; border-color: #000000;"
width="935">
<e:dataTr>
<e:dataTd>
<h:commandLink actionListener="#{bean.editChild}"
value="Detail"
styleClass="tableListLink">
<f:attribute name="childId" value="#{ROW.id}"/>
</h:commandLink>
</e:dataTd>
<e:gridTd id="attr1" labelText="ATTR_1"
value="#{ROW.attr1}"
onendedit="#{bean.updateAttr1}">
</e:gridTd>
<e:gridTd id="attr2" labelText="ATTR_2"
value="#{ROW.attr2}"
onendedit="#{bean.updateAttr2}">
<f:facet name="editMode">
<h:selectOneMenu value="#{ROW.attr2}" styleClass="fieldInput">
<f:selectItems value="#{bean.attr2List}"/>
</h:selectOneMenu>
</f:facet>
</e:gridTd>
<e:gridTd id="date894" labelText="DATE 894"
value="#{ROW.date894}"
onendedit="#{gean.update894}">
<h:outputText styleClass="dataTablePrintColumn"
value="#{ROW.date894}"
style="text-align:left;">
<f:convertDateTime pattern="MM/dd/yyyy"/>
</h:outputText>
<f:facet name="editMode">
<e:dateinput value="#{ROW.date894}" style="border:1px solid;"
pattern="MM/dd/yyyy"/>
</f:facet>
</e:gridTd>
cobar


Joined: 08/01/2007 17:02:58
Messages: 98
Offline

I figured it out. When you bind the model to the list it does not pass a reference to the list in the parent object but creates a deep copy. I can see the objects being updated on the onEndEdit event and when I look at them via the model I get the updated objects.


ArrayList<ChildPojo> muxList = (ArrayList<ChildPojo>) gridModel.getWrappedData();
 
Forum Index -> DataTable
Go to:   
Powered by JForum 2.1.7 © JForum Team
Home   |  News   |  Contact   |  About   |  License   |  Privacy   |  Documentation
Copyright © 2009 Simplica Corporation. All rights reserved.