django-slick-reporting
django-slick-reporting copied to clipboard
Ability to hide columns
Hi,
I needed to hide a columns as I was using django-money and need the field_currency value (which it create for a MoneyField (which is a DecimalField + CharField with the currency type) to be able to do this:
def format_row(self, row_obj):
row_obj['value'] = Money(row_obj['value'], row_obj['value_currency'])
As I found no option to hide the column I added some code to make this possible.
Please review it and request changes if necessary.
You always need to explicitly set the columns you want to show... i do not understand the case when you need the hide columns options.
In this example I mentioned I use a column which has the currency type (such as USD, EUR, etc) to format the value column. In this system multiple types of currencies are used, so I need this info that per row. The currency type is only used to format, as it's not necessary to show the user. Another usage would be if you wanna concatenate column data into one column.
def format_row(self, row_obj): row_obj['value'] = Money(row_obj['value'], row_obj['value_currency'])
There are two ways to add new properties to an object:
var obj = {
key1: value1,
key2: value2
};
Using dot notation:
obj.key3 = "value3";
Using square bracket notation:
obj["key3"] = "value3";
The first form is used when you know the name of the property. The second form is used when the name of the property is dynamically determined. Like in this example:
var getProperty = function (propertyName) {
return obj[propertyName];
};
getProperty("key1");
getProperty("key2");
getProperty("key3");
A real JavaScript array can be constructed using either: