This is a migrated thread and some comments may be shown as answers.

Client-side API Reference > GridTableView > Methods > extractOldValuesFromItem

5 Answers 156 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Pabanas
Top achievements
Rank 1
Pabanas asked on 03 May 2009, 04:35 PM

ms-help://telerik.aspnetajax.radcontrols.2008.Q3/telerik.aspnetajax.radgrid.2008.Q3/grid-extract-old-values-from-item.html

             Above is the help documentation  link of Telerik Client side API .  Below is the sample function to  extract old values in the client side . In the below code the variable args is not assigned any object . Can any one please correct the error .

            I am trying to have a grid for fast dataentry on the client side . I am having fixed  rows of 10  in edit mode using pre render . So all rows are in inline edit mode .  I want to extract old and new values in the client side and control the grid action  .

            Please can you advice me with 100 % client side  on the following skills .

            1) get old and new values  in client side .

            2) how to restrict or enable or disable a cell in grid depending on another cell value .
        
             3) I want to validate the row content and on satisfied condition i want it to go to the next row  or else restrict the user to move forward .

         
              Thanks in advance for your help .
       
function GetFirstEditedItemOldValues()
{
  var masterTable = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
  
  var oldValues=args.get_tableView().extractOldValuesFromItem(0);
  var oldValuesSB = new Sys.StringBuilder();

  for(var property in oldValues)
  {          
    oldValuesSB.append(String.format("<b>{0}</b> : {1} <br/>", property,oldValues[property]));
  } 
}

5 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 07 May 2009, 07:01 AM
Hello Pabanas ,

Thank you for your report on the documentation discrepancy, I will ensure it is corrected shortly.
Assuming that you have a grid in edit mode, you can extract the values as shown in the following code:

.aspx
<asp:Label runat="server" ID="Label1" Text="Test" onclick="extractEditFormData();">  
            </asp:Label> 

.Js
 <script type="text/javascript">  
                      
                  function extractEditFormData()  
                  {  
                  var masterTable = $find("<%= RadGrid1.ClientID %>").get_masterTableView();  
    
                  var oldValues=masterTable.extractOldValuesFromItem(0);  
                  var oldValuesSB = new Sys.StringBuilder();   
 
                        for(var property in oldValues)  
                        {            
                        oldValuesSB.append(String.format("<b>{0}</b> : {1} <br/>", property,oldValues[property]));  
                        }                       
                  }  
                          
                </script> 

Further, you can get any cell in edit mode, by using its client id. for example, you can assign an onchange client side handler to a specific cell on the server, and pass the handler the client id of the dependent cell.
I hope this information helps.

Sincerely yours,
Yavor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Pabanas
Top achievements
Rank 1
answered on 07 May 2009, 12:19 PM
Thank you for your reply .

 Can you please give a code example for the idea suggested by you .

I like to know if i can be give points for pointing out the documentation error .

 
0
Yavor
Telerik team
answered on 11 May 2009, 01:00 PM
Hi Pabanas ,

Attached to this message, is a small application, which handles a similar task. I hope it helps.

Sincerely yours,
Yavor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Nguyen Anh Tai
Top achievements
Rank 1
answered on 16 Aug 2011, 10:18 AM
Hi Yavor,

Your sample seems wrong. It has nothing to do with the CLIENT extractOldValuesFromItem method. Could you provide the correct sample of CLIENT extractOldValuesFromItem and extractValuesFromItem methods as I am currently looking for the same.

Best regards,

Tai 

 
0
Veli
Telerik team
answered on 18 Aug 2011, 03:35 PM
Hi Nguyen Anh Tai,

The extractOldValuesFromItem method works with client-side databinding only. Particularly, it searches the client-side data object assigned to the particular grid item, therefore, cannot be used with server-side databinding. During research, we discovered an issue with the extractValuesFromItem method, which is supposed to work with server-side binding too. Our dev team was able to fix the issue right away, and it will be included in the upcoming service pack release. As a workaround, you currently need to call GridTableView.get_dataItems() to have the client-side GridDataItem components initialized before extraction. This prevents a JS error you may get and fixes the behavior of the extractValuesFromItem method. So, to summarize:

extractOldValuesFromItem: does not work with server-side databinding.
extractValuesFromItem: works with server-side databinding, but only after get_dataItems() has been previously called. Will be fixed for SP1.

Greetings,
Veli
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Grid
Asked by
Pabanas
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Pabanas
Top achievements
Rank 1
Nguyen Anh Tai
Top achievements
Rank 1
Veli
Telerik team
Share this question
or