Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Duplicated icon _id on SelectIitem + icons in ListGrid

    Example:
    Add an icon to Continent field in listType example at http://www.smartclient.com/index.jsp#listType:

    Code:
    isc.ListGrid.create({
        ID: "countryList",
        width:500, height:224, alternateRecordStyles:true, 
        canEdit:true, editEvent:"click", modalEditing:true,
        data: countryData,
        fields:[
            {name:"countryCode", title:"Flag", width:50, type:"image", imageURLPrefix:"flags/16/", imageURLSuffix:".png", canEdit:false},
            {name:"countryName", title:"Country"},
            {name:"continent", title:"Continent",
                valueMap:["Europe", "Asia", "North America", "Australia/Oceania", "South America", "Africa"],
                icons: [ {} ]
            }
        ]
    })
    Steps to reproduce the problem:
    - run the example
    - click on the Country column in the first row (United States) in order to edit the row
    - click the picker icon on Continent column (North America): it works OK - the item list shows / hides properly
    - click on the Country column in the second row (China) in order to edit the row
    - click the picker icon on Continent column (Asia): it DOESN'T WORK: the item list is not shown because the [...] icon gets the click instead of picker icon

    Rationale:
    The problem is that the picker icon and the [...] icon has the same _id value: "_0" in the second and following edits.

    It seems that when editing second row the icons property is reused from the first row, so icons _ids are already assigned, while the _nextIconId is reset to 0. The picker icon gets _id "_0" by calling _setIconId(), which is the same as the [...] icon _id. When the clicked icon is serched, the [...] is find before the picker icon, so it gets the click.

    Workaround:
    Set icon _id to an user defined value. Icon _id is mangled to $151 in SmartClient 70rc2:

    Code:
    ...
            {name:"continent", title:"Continent",
                valueMap:["Europe", "Asia", "North America", "Australia/Oceania", "South America", "Africa"],
                icons: [ {$151: "_my_id"} ]
            }
    ...
    Last edited by borutr; 12 Oct 2009, 08:23.
Working...
X