-
Notifications
You must be signed in to change notification settings - Fork 2
Grid viewer
Grid viewer is a feature of SPCoder that allows you to view the values of any object from SPCoder context in a form of grid. It is useful for inspecting the values of collections.
Grid viewer window is by default opened in central dock position. It can be activated by clicking the Viewer button on Toolstrip or Grid viewer button in main Window menu.
Grid viewer uses DataGridView control for displaying objects. To bind the object to the grid you need to write the name of the object in text field above it and click the View button. You can also use expressions or even call methods and grid will display the result of method execution.
This example shows the use of expressions where you list the content of main.Modules
variable in grid viewer:
This example shows the simple way to create DataTable object using code and the result when that object is shown in Grid viewer.
var dt = new DataTable();
dt.Columns.Add("col1");
dt.Columns.Add("col2");
dt.Rows.Add(new string[] {"val 1", "val 2"});
dt.Rows.Add(new string[] {"val 3", "val 4"});
Grid viewer can also opened directly from code with the following code:
main.SpGrid.ShowExpressionInGrid("dt");
main.ShowGridWindow();
Method ShowExpressionInGrid expects the valid c# expression or name of the variable as a parameter.
This mechanism is used by some of the plugins to display data. Show items in grid plugin for SharePoint lists and libraries uses this mechanism to display Items after it downloads them from server.
The same thing is used by Show data in grid plugin for Excel files with File system connector.