#NEWLINE# def add_column( self , func , name = None , show = True ) : #NEWLINE# #INDENT# 'Add a column function which takes an id as argument and\n        returns a value.' #NEWLINE# assert func #NEWLINE# name = ( name or func . __name__ ) #NEWLINE# if ( name == '<lambda>' ) : #NEWLINE# #INDENT# raise ValueError ( ( 'Please provide a valid name for ' + name ) ) #NEWLINE# #UNINDENT# d = { #NEWLINE# #INDENT# 'func' : func , #NEWLINE# 'show' : show , #NEWLINE# #UNINDENT# } #NEWLINE# self . _columns [ name ] = d #NEWLINE# data = _create_json_dict ( cols = self . column_names ) #NEWLINE# self . eval_js ( 'table.setHeaders({});' . format ( data ) ) #NEWLINE# return func