I need to be able to scrolltoview and then put the cell in edit mode. Here is my code. if the cell is visible with out scrolling the cell is in edit mode if it has to scroll then not.
thanks
if (val == "0" || val == "0.00") {
var editing = grid.get_behaviors().get_editingCore().get_behaviors().get_cellEditing();
var firstCell = grid.get_rows().get_row(i).get_cell(0);
editing.enterEditMode(firstCell);
grid.get_rows().get_row(i).get_cell(0).scrollToView();
}
Hello mburk2,
Thank you for posting in our community.
If I understood your requirement right, I would suggest you to use two input text fields and one button at the bottom of the grid, which will serve for entering respectively the row and the cell value and on the button click the grid will scroll to view according to the entered row/cell values and the entedEditMode() method will be invoked for the current cell. For instance:
function scrollToView() {
var grid = $find("WebDataGrid1");
var row = document.getElementById("row").value;
var cell = document.getElementById("cell").value;
var rowValue = parseInt(row);
var cellValue = parseInt(cell);
var currentCell = grid.get_rows().get_row(rowValue).get_cell(cellValue);
currentCell.scrollToView();
editing.enterEditMode(currentCell);
Attached is a sample with similar scenario for your reference.
Please take a look at it and let me know if you have any further questions.
Sincerely,
Tsanna
Thanks for your help but here is one of the problems I'm having. Using your example shrink your grid to only show 4 rows then in the text boxes enter 8 0 and hit scroll. Then enter 1 0 and hit scroll. The scroll does not go up correctly.
thanks for the help
Mike
In this case I would recommend you to use scrollIntoView method for the element of the grid cell:
grid.get_rows().get_row(rowValue).get_cell(cellValue).get_element().scrollIntoView();
And the complete javascript function will look like:
If you have any further concerns or questions, please let me know.
Thank you for your feedback.
If you need any further assistance regarding this matter, do not hesitate to contact me.
Thanks so much works great.