Announcement

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

    Inconsistent selection on HTML ListGrid cell context click

    SNAPSHOT_v9.1d_2013-10-06

    Browsers: Chrome 31 OSX, Chrome 31 Win7; IE11

    To re-create, pick a simple ListGrid e.g.

    http://www.smartclient.com/#columnSize

    Modify thus:

    Code:
    isc.ListGrid.create({
      ID: "countryList",
      width:500, height:224, alternateRecordStyles:true,
      data: countryData,
      fields:[
          {name:"countryCode", title:"Flag", width:50, type:"image", imageURLPrefix:"flags/16/", imageURLSuffix:".png"},
          {name:"countryName", title:"Country",
          formatCellValue:function(value, record, rowNum, colNum, grid) {
            return "<a href='#'>" + value + "</a>";
          }
      },
          {name:"capital", title:"Capital"},
          {name:"continent", title:"Continent"}
      ],
      rowContextClick:function(record, rowNum, colNum) {
        console.warn("Selection length " + countryList.getSelection().length);
        if (!countryList.getSelection().contains(record)) {
          console.warn("Did not contain record " + rowNum);
        }
      },
      canResizeFields: true
    })
    Essentially this alters the country column to render as HTML links.

    If you context-click on a row, anywhere apart from the pixels over the links, then you'll just see 'Selection length 1' in the console.

    However, if you context-click over the pixels of the link, then you'll see the 'Did not contain record x' message. Unless you context-click on a row that you have already selected (by clicking elsewhere on that row).

    Seemingly, context-clicking on the link somehow prevents the record from being selected (the normal (and expected!) behaviour).
Working...
X