[jboss-user] [JBoss Seam] - Re: need help using DataModelSelectionIndex

asookazian do-not-reply at jboss.com
Tue Nov 20 11:52:40 EST 2007


"Kragoth" wrote : As far as I know or at least as far as I can tell, you cannot have a DataModelSelectionIndex and a DataModelSelection on the same DataModel.
  | 
  | You need to choose, do you want the index or the object.
  | 
  | There really is no point in having the DataModelSelection if you have the index as you can get the selected object using the index.
  | 
  | So up to you, if you need the index then do your lookup with the index value to return the selected object.
  | 
  | Hope that makes sense.
  | 
  | for example.
  | 
  | You wrote:
  | 
  |   | @DataModel(value="myAuditList")
  |   | private List myAuditList;
  |   | 		
  |   | @DataModelSelection(value="myAuditList")
  |   | private Object[] myAuditListSelection;
  |   | 		
  |   | @DataModelSelectionIndex(value="myAuditListSelection")
  |   | //this is the row number of the underlying collection
  |   | private int currentRowNum;	
  |   | 
  | 
  | 
  | Change it to:
  | 
  |   | @DataModel(value="myAuditList")
  |   | private List myAuditList;
  |   | 		
  |   | private Object[] myAuditListSelection;
  |   | 		
  |   | @DataModelSelectionIndex(value="myAuditListSelection")
  |   | //this is the row number of the underlying collection
  |   | private int currentRowNum;	
  |   | 
  |   | public Object[] getMyAuditListSelection() {
  |   |   return myAuditList.get(currentRowNum);
  |   | }
  |   | 
  | 
  | 
  | That should work.....however I havn't tested this so dont' just copy and paste, but that is the general idea ok.

ok, thx. this makes sense to me.  I'll try this.  I'd say that the Seam doc needs to be clearer on this as there is no example of DataModelSelectionIndex in the Seam distro...  thx.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4106476#4106476

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4106476



More information about the jboss-user mailing list