I have two grids. I need to do this client side in JavaScript. When a cell value of Grid1 is changed I need to find and change a cell value in Grid2. TI can't find an example of what I am trying to do. Thanks in advance for providing one.
Take your time, and do not hesitate to post in this thread if you need further assistance with this matter.
Got it! But I might have a follow up. Please do not close this case. I will check back in when complete. Thank you.
Hello,
I have double checked the attached sample and I can verify that it describes your scenario. There are two WebDataGrids controls and the client-side CellValueChanged event is handled as per your requirement. When value in the first grid is changed, a cell value in the second grid reflects the changes.
<script> function reflectChangeToSecondGrid(sender, eventArgs) { const secondGrid = $find("secondWDG"); let currentCell = eventArgs.get_cell(); let value = currentCell.get_value(); let rowIndex = currentCell.get_row().get_index(); let columnIndex = currentCell.get_column().get_index(); if (typeof value === "number") value *= 2; secondGrid.get_rows().get_row(rowIndex).get_cell(columnIndex).set_value(value); } </script>
Please download the sample again in order to confirm my statement.
Looking forward to hearing from you.
The sample you uploaded has nothing to do with my question. Answering my question with an example would require a sample with some JavaScript and two web data grids. This sample has no JS and only 1 datagrid. It is so off point that I think maybe you uploaded the wrong zip file. What I need is:
When a cell value in Grid 1 is changed I want to select a cell in Grid 2 (via javascript) and change it. Example:
function Grid1_CellEditing_ExitedEditMode(sender, eventArgs) {
var techLaborBelow = sender.get_rows().get_row(ROW_INDEX_LABOR_TECH_LABOR_BELOW).get_cell(currentCellAddress).get_value();
// Now change a cell in Grid 2
select a row in grid 2 then select the cell in that row then change the value
grid2SelectedCell.set_value(techLaborBelow * 2);
Thank you for the provided clarification. I have created and attached a sample project demonstrating the desired behavior.
Please test it and let us know if you need any further assistance with this matter.
1362.Sample.zip