I'm using the 11.2 ASP controls in VS2010 using the WebHierarchicalDataGrid control
I'm doing everything on the server side. I have a column with a button that is wired up to a click event. When I click the button I execute some SQL that updates a value in the current row.
How do I get the updated value to show up in the current row?
Seems like I should be able to tell the grid to do a refresh on the current row.
Thanks.
Brian.
We have decided to skip the feature for now. I'll let you know if we get back to it and need help to resolve it.
Thanks,
Hello Brian,
Can you update me with your progress on this case?
If you have any questions do not hesitate to contact me.
Sincerely,
Georgi Sashev
Developer Support Engineer
Infragistics, Inc.
http://ko.infragistics.com/support
Can you provide me with a sample that reproduces this in order for me to investigate it further and assist you in finding a solution.
Looking forward to hear from you.
Georgi ,
Thanks for the reply and sample code.
However, in my case the solution is much simpler.
I was told I needed to use this code...
var activeCell = parentGrid.get_behaviors().get_activation().get_activeCellResolved();
Now I can get to the active cell for the row the button was clicked in.
I think your code would find the active cell if the button I clicked on was outside the grid.
However, the one problem I now have is that I cannot set the value of the active cell.
The column in my grid is a template that contains a button, the column is a boolean and tied to the enabled property of the button. This seems to work fine. But, when I try to set the value of the cell in the javascript the button disapears.
The code I'm using is...
activeCell.set_value(false);
This causes the button to disapear and the text "false" to show up in it's place.
I think the issue has to do with the fact I'm using a template for this cell.
Any suggestions on how to correctly set the value when using a template?
It is possible the ActiveCell to be null if you are trying to retrieve the activeCell of the child band. Here I will show you what function I created.
function btnOne_Click() { var grid = $find("WebHierarchicalDataGrid1"); var parentGrid = grid.get_gridView(); var childGrid; var text; var activeCell; if (grid != null) { activeCell = parentGrid.get_behaviors().get_activation().get_activeCell(); if (activeCell != null) { text = activeCell.get_text(); } else { for (i = 0; i < grid.get_gridView().get_rows().get_length(); i++) { if (grid.get_gridView().get_rows().get_row(i).get_expanded()) { var childGrid = grid.get_gridView().get_rows().get_row(i).get_rowIslands(0)[0]; if (childGrid != null) { activeCell = childGrid.get_behaviors().get_activation().get_activeCell(); if (activeCell != null) text = activeCell.get_text(); } } } } if (text != null) alert(text); } }
function btnOne_Click() {
var grid = $find("WebHierarchicalDataGrid1");
var parentGrid = grid.get_gridView();
var childGrid;
var text;
var activeCell;
if (grid != null) {
activeCell = parentGrid.get_behaviors().get_activation().get_activeCell();
if (activeCell != null) {
text = activeCell.get_text();
}
else
{
for (i = 0; i < grid.get_gridView().get_rows().get_length(); i++) {
if (grid.get_gridView().get_rows().get_row(i).get_expanded())
var childGrid = grid.get_gridView().get_rows().get_row(i).get_rowIslands(0)[0];
if (childGrid != null) {
activeCell = childGrid.get_behaviors().get_activation().get_activeCell();
if (activeCell != null) text = activeCell.get_text();
if (text != null) alert(text);
Add this button to the page
<input type="button" id="btnOne" value="active cell" onclick="return btnOne_Click();"/>
This function will display the value of the active cell. Try it and let me know if it works for you. Or if you have any further questions