Wiki

Case Status Kiln
Register Log In

Wiki

 
"How To" Guides»Implementing IPluginGridColumn
  • RSS Feed

Last modified on 12/15/2014 5:09 PM by User.

Tags:

Implementing IPluginGridColumn

FogBugz Plugin Interfaces > Filters > IPluginGridColumn

Introduction

This article will demonstrate a simple FogBugz plugin that implements the IPluginGridColumn interface contained in the FogCreek.FogBugz.Plugins.Interfaces class library.

This plugin adds a table, Kiwi and joins it to the Bug table (see Implementing IPluginDatabase and Implementing IPluginBugCommit, IPluginBugDisplay, IPluginBugJoin) for the purpose of demonstrating the addition of two columns to the grid view. It does not provide an interface to add entries to the Kiwi table. To do that, see Implementing IPluginDatabase. For a more advanced treatment involving joining a table in the database and allowing filtering based upon it, see Implementing IPluginGridColumn, IPluginFilterJoin...

IPluginGridColumn requires implementation of four methods:

  1. GridColumns() returns the information about the columns you want to create: name, title, etc. use the iType CGridColumn property to give each a unique integer key. In the other methods, use a switch statement on that
  2. GridColumnQuery(CGridColumn col) returns the CBugQuery used to get the data you want in the column. The query only needs to join in your data if it is not already done in IPluginBugJoin.
  3. Next, you need to define what is going to be displayed with GridColumnDisplay(CGridColumn col, CBug[] rgBug, bool fPlainText) For example, if you're fetching an email address from the database, you may want to return an html link. Remember to HtmlEncode anything coming out of the database.
  4. The last method is for when the column is sorted, CSelectQuery GridColumnSortQuery(CGridColumn col, bool fDescending, bool fIncludeSelect). It should call the same function as the select, and just add the orderby. It should also only select if fIncludeSelect is true and your table is not joined automatically via IPluginBugJoin.

Functionality

This plugin will create and join a new table "kiwis" and add the fields to the filter drop-down so they may be displayed as columns in the grid view.

Compile and Install It On Your Own

Download the source file:   IPluginGridColumn_Example.cs

Then follow these instructions to create a functioning plugin assembly: Compiling and Installing a FogBugz Plugin