Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Udaya on Jul 06, 2008 22:15
open dhtmlx forum
Row focus on move row - Urgent Help!!!

My grid is not moving automatically to scroll up or down to show row/cell in focus.Any idea why is this happening??Iam using dynamic smart rendering.Iam giving here the way iam initializing the grid.

function loadDefaultGrid()
    {    
        //Initialize the grid
        var initialGrid = "RecurringJobRequestAction.do?param=initial";
        RecurringGrid = new dhtmlXGridObject("RecurringGridBox");
        RecurringGrid.imgURL = "images/";
        RecurringGrid.setHeader("A,B,C,D,E,F,G,H");
        RecurringGrid.setInitWidthsP("8,20,12,12,12,12,12,12")
        RecurringGrid.setColAlign("center,center,center,center,center,center,center,center")
        RecurringGrid.setColTypes("link,ro,ro,ro,ro,ro,ro,ro");
        RecurringGrid.init();
        RecurringGrid.enableSmartRendering(true,20);
        RecurringGrid.loadXML(initialGrid);
    }

    function moveRowUp()
    {        

        var sequenceList =new Array();
        RecurringGrid.moveRowUp(RecurringGrid.getSelectedId());
        var selectedRowIndex = RecurringGrid.getRowIndex(RecurringGrid.getSelectedId());
        var BelowselectedRowIndex = RecurringGrid.getRowIndex(RecurringGrid.getSelectedId())+1;
         var id=RecurringGrid.getRowId(selectedRowIndex);
          var id1=RecurringGrid.getRowId(BelowselectedRowIndex);
          RecurringGrid.getRowById(id); //force rendering
          sequenceList.push(RecurringGrid.cells(id,0).getValue());
          RecurringGrid.getRowById(id1); //force rendering
          sequenceList.push(RecurringGrid.cells(id1,0).getValue());


    }
Answer posted by Support on Jul 07, 2008 01:50
It is not clear, which code you are using to select row in grid.
In common case the use of
    grid.selectRowById(id);
must work correctly for any row in grid, as far as each row has unique ID
Answer posted on Jul 07, 2008 02:00

My requirement is to select a row and move that up or down.When doing so,the scroll bar should automatically move up or down to see the selected row.But the scroll bar remains still without scrolling automatically to show the selected row.The code which i gave refers how to initialize the grid and how iam doing the move row functionality.

    function moveRowUp()
    {         
             RecurringGrid.moveRowUp(RecurringGrid.getSelectedId());         

    }             

So even though i move up to the first position from the last record,the scroll bar doesnt move and the user is unable to see the record he moved up..He has to manually scroll up to see that.In my grid,i have onlly vertical scroll bar and no horizontal scroll bars.

Answer posted by Support on Jul 07, 2008 10:06
You need to call grid.showRow, after moving row to new position

function moveRowUp()
{         
             RecurringGrid.moveRowUp(RecurringGrid.getSelectedId());
             RecurringGrid.showRow(RecurringGrid.getSelectedId()); //scroll to row
}