Hi All,
I have an ultrawebgrid with virtual scrolling ajax. I select one record and change in in a modal popup window, then when I return from the modal i would like to trigger a
gridLCN.invokeXmlHttpRequest(gridLCN.eReqType.Refresh,
null, "");
but I want only the current row to be refreshed and not the whole grid. I don't want change cell by cell in grid but trigger a refresh only of that row so I don't lose the scroll position of the grid nor it send me to the first record of the grid.
Any ideas are appreciated.
Hi Rado,
Thank you for your reply.
I can see the approach you use, you update the gride then send the update request to the server and the server updates the database (Unless I missunderstood the example, after many hours of work things start to look different lol...)
My approach is the other way round. I update the sql db in my pop up window when the user press "save" button, and then close the pop up windo and once back to the screen where the grid is I would like the grid just to pull the recently changed row from the server and update the row in the Grid. So in other words, first I update the DB with the pop up window, then I would like the Grid to reload that row when returning from my pop up window. I can do it with returnValue from the showmodalwindow but in this case because the there are many fields in my popup that i would need to concatenate and send back to the screen where the grid is.
Another Scenario where my method applies is let's say that in the grid I added a templated tick box, then the user selects 10 rows, then a button that takes the user to a popup window where he changes the 10 rows, then he hits the save button on the popup and returns to the screen where the grid is, so I would expect that with the rowids I could trigger a request from the server that brings the new data of only 10 rows (as I have saved the rowid of each row I could do a loop to trigger 10 row refreshes for example).
Maybe the way is as you suggested, if I change the grid from within the popup when the users hits the save button?,
Hello,
If I understand your scenario, I would suggest to implement it in this way:
I have put a button on the page that will be used to trigger AJAX Refresh and just simulate popup window. So, in the button click event I am taking a reference to the grid, then I update the second cell from the first row. Once the cell has been updated I make the refresh.
function Button1_onclick() { var oGrid = igtbl_getGridById('UltraWebGrid1'); var newValue = "Data"; var rowId = 0; oGrid.Rows.getRow(0).getCell(1).setValue(newValue, true); oGrid.invokeXmlHttpRequest(oGrid.eReqType.Custom,null,newValue +"-"+ rowId); }
There is event called XMLHttpRequest that is handled on the server. In that event as you can see I transfer the value with that the cell has been updated.
protected void UltraWebGrid1_XmlHTTPRequest(object sender, Infragistics.WebUI.UltraWebGrid.XmlHTTPRequestEventArgs e) { var type = e.Type; var data = e.Data;
//do the update here. }
The grid keeps the position after this update, also I used XMLLoadOnDemand= Acumulative.
Attached is my sample as well.
This is that the that I have a grid with vritual scrolling, ajax, then the user scrolls down and the grid pulls automatically more rows from the server as the user scrolls down, then the user clicks on q templated field "Edit" of a specific row and I open that record in a modal window, then the user changes and saves the record which updates the server. When the user hits the save button I window.close and return to the main screen where the grid is, thing is that I don't want to return the values form the modal window and change the grid row in javascript by changing cell by cell, but instead I would like to trigger a "refresh row" so the grid pulls the updated row from the server and refreshes only that row, in this way I don't lose the current position of the grid and the row gets refreshed.
Would the UpdateRow Method do what I need?, Could you please provide a line with an example of the eReqType.UpdateRow ?
This is my Edit Sub in JavaScript.
function EditLCN_Click() { var row = gridLCN.getActiveRow(); var rowlcn = row.getCellFromKey("Local Composition Number").getValue(); var aLCNArgs = new Array(_txtcurrentuserLCN.Element.value, rowlcn); var currentbackground = document.bgColor; document.bgColor = '#CCCCCC'; var myRand = rand(50000); returnValue = window.showModalDialog('EditLCNv2.aspx?s=' + rowlcn + '&v=a' + '&rand=' + myRand, aLCNArgs, 'resizable=yes;unadorned=no;scroll=yes;status=no;dialogWidth=1008px;dialogHeight=700px;'); document.bgColor = currentbackground; if (returnValue != false) { // _txtoperationsmessage = returnValue; gridLCN.invokeXmlHttpRequest(gridLCN.eReqType.Refresh, null, ""); //but this refreshes the whole grid and makes the grid jump to the first row... } return false; }
Many thanks
Federico.
Hello Federico,
You can specify what kind of request to be issued to the server check that out :
eReqType.UpdateCell - the cell that is being updated;
eReqType.AddNewRow - the rows collection a new row is added to;
eReqType.Sort - the rows collection that is being sorted;
eReqType.ChildRows - the row which child rows are requested;
eReqType.DeleteRow - the row that is being deleted;
eReqType.UpdateRow - the row that is being updated.
eReqType.Filter - the rows collection the filter is being applied to;
eReqType.FilterDropDownFill - the rows collection the filter is being
If you want to issue the request from code running on the child window you can access the parent window through opener.grid.invokeHttpRequest()……
Please refer the client side object model:
http://help.infragistics.com/NetAdvantage/ASPNET/2010.3?page=WebGrid_Object_CSOM.html
Hope this helps.