Announcement

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

    ListGrid body.scrollTo

    A while ago, I had the problem of being able to scroll to a specific row selected and it was suggested that I use the following code:

    this.body.scrollTo(null, (this.cellHeight)*selectedRow);

    I have the following testcase using the smartclient feature explorer. I'm expecting it to scroll down to my selected row when the data has arrived but it does not.

    Code:
    isc.ListGrid.create({
        ID: "countryList",
        width:522, height:224,
        alternateRecordStyles:true, cellHeight:10,
        dataSource: countryDS,dataArrived: function(startRow, endRow){this.selectRecord(15); this.body.scrollTo(null, (this.cellHeight)*15);},
        // display a subset of fields from the datasource
        fields:[
            {name:"countryName"},
            {name:"government"},
            {name:"continent"},
            {name:"countryCode", title:"Flag", width:40, type:"image", imageURLPrefix:"flags/16/", imageURLSuffix:".png", canEdit:false}
        ],
        groupStartOpen:"all",
        groupByField: 'continent',
        autoFetchData: true
    
    })

    #2
    If you mean that it doesn't scroll all the way there, the problem is that the cell height is too small for the text, so the rows are actually taller than 10px.

    Comment


      #3
      Even if I increase the cell height, it does not make a difference. The scrollbar still does not move down even the slightest bit.

      Comment


        #4
        There's an issue here where the ListGrid is resetting the scroll position due to the arrival of a new dataset. This works for now:

        Code:
            dataArrived: function(startRow, endRow){
                var _this = this;
                isc.Timer.setTimeout(function () {
                    _this.selectRecord(10);
                    _this.body.scrollTo(null, (_this.cellHeight)*10);
                });
            },
        A cleaner API that can also be called while data is still being fetched is coming.

        Comment


          #5
          Ok. Will try this. Thanks.

          Comment

          Working...
          X