Ignore:
Timestamp:
Feb 10, 2010, 2:49:13 AM (15 years ago)
Author:
gav
Message:

Improvements to CustomTagLib checkBoxList, sorting, dynamic displayFields and a small fix to the domain class set method.

Location:
trunk/grails-app/domain
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/domain/Asset.groovy

    r329 r343  
    2626    }
    2727
    28     //  This additional setter is used to convert the checkBoxList string
     28    //  This additional setter is used to convert the checkBoxList string or string array
    2929    //  of ids selected to the corresponding domain objects.
    3030    public void setAssetSubItemsFromCheckBoxList(ids) {
    3131        def idList = []
    32         ids.each() {
    33             if(it.isInteger())
    34                 idList << it.toInteger()
     32        if(ids instanceof String) {
     33                if(ids.isInteger())
     34                    idList << ids.toInteger()
     35        }
     36        else {
     37            ids.each() {
     38                if(it.isInteger())
     39                    idList << it.toInteger()
     40            }
    3541        }
    3642        this.assetSubItems = idList.collect { AssetSubItem.get( it ) }
  • trunk/grails-app/domain/Person.groovy

    r294 r343  
    5555    String toString() {"${this.firstName} ${this.lastName}"}
    5656
    57     //  This additional setter is used to convert the checkBoxList string
     57    //  This additional setter is used to convert the checkBoxList string or string array
    5858    //  of ids selected to the corresponding domain objects.
    5959    public void setPersonGroupsFromCheckBoxList(ids) {
    6060        def idList = []
    61         ids.each() {
    62             if(it.isInteger())
    63                 idList << it.toInteger()
     61        if(ids instanceof String) {
     62                if(ids.isInteger())
     63                    idList << ids.toInteger()
     64        }
     65        else {
     66            ids.each() {
     67                if(it.isInteger())
     68                    idList << it.toInteger()
     69            }
    6470        }
    6571        this.personGroups = idList.collect { PersonGroup.get( it ) }
Note: See TracChangeset for help on using the changeset viewer.