def init_columns(self, columns): # TODO: compute the correct width for each column. self.columns = [] default_width = 0.99 / len(columns) for col in columns: if type(col) == str: col = dict(name=col, width=default_width) assert type(col) == dict if not 'label' in col: col['label'] = labelize(col['name']) self.columns.append(col)
def init_columns(self, columns): # TODO self.columns = [] default_width = '{:2.0f}%'.format(0.99 / len(columns) * 100) for col in columns: if isinstance(col, string_types): col = dict(name=col, width=default_width) assert type(col) == dict col.setdefault('width', default_width) col.setdefault('sorting', ('asc', 'desc')) if 'label' not in col: col['label'] = labelize(col['name']) self.columns.append(col)
def init_columns(self, columns): # TODO: compute the correct width for each column. self.columns = [] default_width = 0.99 / len(columns) for col in columns: if type(col) == str: col = dict(name=col, width=default_width) assert type(col) == dict if 'label' not in col: col['label'] = labelize(col['name']) col.setdefault('sorting', ["asc", "desc"]) if not col['sorting']: col.setdefault('sortable', False) else: col.setdefault('sortable', True) self.columns.append(col)