Results 1 to 2 of 2
  1. #1
    rchiu5hk is offline Member
    Join Date
    Apr 2011
    Posts
    13
    Rep Power
    0

    Default primefaces dataTable selection records of composite key as rowKey

    Dear all,

    I have primefaces dataTable with selection. But I find that when I select the records, the "selectedTeachers" are still empty.
    I guess it may be rowKey problem which is "compositeKey". Isn't it?? Do you have any ideas?? Please help..



    //------------------------------------------------
    <p:dataTable var="item" value="#{uploadVo}"
    rowKey="#{item.compositeKey}"
    selection="#{selectedTeachers}" rowIndexVar="index"
    id="gridItemName" rowSelectMode="checkbox" >
    <p:column selectionMode="multiple"/>
    //---------------------------------------------------------------------

    public Object[] getCompositeKey() {
    return new Object[] { this.batchNumb, this.schlnumb,this.schllocnid,
    this.schllevltypecode, this.schlsesstypecode, this.schlYear,
    this.schlnumbAdd, this.schllocnidAdd, this.schllevltypecodeAdd,
    this.schlsesstypecodeAdd, this.priIdTypeCode, this.priIdNo,
    this.issuePlaceCode, this.edbSubjCode, this.seq};
    }

  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    12

    Default Re: primefaces dataTable selection records of composite key as rowKey

    The rowKey should be a unique primitive value for best effect, most notably an Integer. Say an ID property of your database records if they have one.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. JSF - PrimeFaces, why both? Is one enough? If not why?
    By bineeth in forum JavaServer Faces (JSF)
    Replies: 1
    Last Post: 09-16-2013, 09:59 PM
  2. JSF Designer and PrimeFaces License
    By rome2 in forum JavaServer Faces (JSF)
    Replies: 1
    Last Post: 08-22-2013, 11:28 AM
  3. Replies: 12
    Last Post: 10-25-2012, 05:26 PM
  4. calling servlet from primefaces
    By java_irakli in forum JavaServer Faces (JSF)
    Replies: 0
    Last Post: 09-12-2011, 01:46 PM
  5. problem with primefaces ajax poll
    By irakli_java_dev in forum JavaServer Faces (JSF)
    Replies: 1
    Last Post: 04-01-2011, 04:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •