Intersoft WebGrid Documentation
How-to: Use Self-Reference Client APIs
See Also Send comments on this topic.

Glossary Item Box

WebGrid provides a set of comprehensive client side API to let developers extend the Grid for their own use.

In this topic, you will learn how to use several Self-Reference Client-Side APIs.

To expand/collapse Self-Reference row

  1. Drag WebGrid instance into the WebForm.
  2. Add a client side function. Use ExpandSelfRefRow() to expand self-reference row and CollapseSelfRefRow() to collapse self-reference row.
    JavaScript Copy ImageCopy Code
    function ToggleExpandCollapse()
    {
       // retrieves WebGrid's object
       var grid = ISGetObject("WebGrid1");
                
       var selectedObject = grid.GetSelectedObject(); // return object of type SelectedObject
                
       if (selectedObject != null)
       {
          var selectedRow = selectedObject.ToRowObject(); // return WebGridRow object
          if (selectedRow.SelfRefExpanded)
          {
             selectedRow.CollapseSelfRefRow(); // collapse self reference row
          }
          else
          {
             selectedRow.ExpandSelfRefRow(); // expand self reference row
          }
       }
       else
       {
          alert ("Please select a row first.");
       }
                            
       return true;             
    }
    

  3. Run the project.

See Also

©2012 Intersoft Solutions Corp. All Rights Reserved.