A Column object represents one Grid column
The Column object defines how a column’s value is retrieved and how it is formatted.
Column is effectively an abstract class - Grids should be using its derived classes.
Initializes a column.
title: The column’s title in the grid. title.lower() is the default column name. model_path: The column’s data field’s path in the model.
For example, if this is the Name column in a grid of Person models, and the person’s name is in the fullname attribute of the Person model, model_path should be fullname. model_path can also access attributes in nested objects: innerobj.attr will be resolved to model_instance.innerobj.attr
**kwargs: All other arguments are copied as is to the column’s colModel.
Returns the column’s “sort-name”, which is used to apply ordering on a queryset.
The default implementation is to take the model_path and replace each . with __ .
Returns the colModel
Returns an HTML representation of the column’s value.
The default implementation is to return the text value.
Returns a text representation of the column’s value.
The default implementation is to convert get_model_value to a string.
Returns the name that goes in the colName JSON
A column that contains simple text strings.
This is basically just a Column. We create a new class because it seems more tidy.
Initializes a column.
title: The column’s title in the grid. title.lower() is the default column name. model_path: The column’s data field’s path in the model.
For example, if this is the Name column in a grid of Person models, and the person’s name is in the fullname attribute of the Person model, model_path should be fullname. model_path can also access attributes in nested objects: innerobj.attr will be resolved to model_instance.innerobj.attr
**kwargs: All other arguments are copied as is to the column’s colModel.
A column that is rendered by a Django template
Use a TemplateColumn when you want the column to contain complex HTML content.
Due to a bug in jqGrid, cell values cannot contain HTML - it conflicts with inline editing. So instead, the cell values returned by the default Grid.get_json_data method will be the text rendering of the column. The HTML data will be placed in the html property of the row’s data.
To actually display the HTML data we use a formatter, called customHtmlFormatter, which resides in djqgrid_utils.js
Initializes a TemplateColumn
You can specify a template or a template_name, but not both.
A column that is rendered as a single <a href=...> link
Initializes a LinkColumn.