Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Igor on Oct 10, 2007 23:16
open dhtmlx forum
Scroll to row on a page not currently displayed (smartrendering)

Dear Community!

I am rendering a grid from mysql database using smart rendering.

On row selection the user gets an ajax window and edits the data. After that I refresh the grid.

Is it possible to scroll to a page which is not rendered yet (as only 2 pages rendered when the grid is displayed).

Or is it possible to refresh only one row of the grid?

Thanx
Igor
Answer posted on Oct 11, 2007 10:40
In case of SRND mode, you can scroll to necessary position by using next code snippet


function scrollTo(grid,pos){

                        var distance = (pos+1)*grid._dloadSize + 20;
                        if(distance>(grid.objBox.offsetHeight+grid.objBox.scrollTop)){
                           var scrollTop = distance - grid.objBox.offsetHeight;
                        }else if(pos*grid._dloadSize<grid.objBox.scrollTop){
                           var scrollTop =  pos*grid._dloadSize-5
                        }
                        if(scrollTop)
                           grid.objBox.scrollTop = scrollTop;
                               
}




>>Or is it possible to refresh only one row of the grid?
You can set values of any cell by

    grid.cells(i,j).setValue(newValue);
i - row ID
j - cell index

or

    grid.cells2(i,j).setValue(newValue);
i - row index
j - cell index


also there is a way to update only few rows by using updateFromXML instead of loadXML
Answer posted by Igor on Oct 11, 2007 20:52
Thank you for your quick answer.

The first one works fine, except that I have to insert an alert and wait for the grid loading, after it is loaded and I press the ok on the alert dialog, the function scrolls to the desired position.

How do I test (in a while loop maybe) if the grid data is loaded?

Thank you in advance.

Best Regards,
Igor
Answer posted on Oct 12, 2007 18:56