--- a/src/pyams_skin/table.py Fri Nov 10 13:35:14 2017 +0100
+++ b/src/pyams_skin/table.py Fri Nov 10 13:35:57 2017 +0100
@@ -12,7 +12,6 @@
__docformat__ = 'restructuredtext'
-
# import standard library
# import interfaces
@@ -67,15 +66,11 @@
@property
def data_attributes(self):
- return {'tr': {'id':
- lambda x, col: '{0}::{1}'.format(self.id, getattr(x, '__name__', '')),
- 'data-ams-element-name':
- lambda x, col: getattr(x, '__name__', None),
- 'data-ams-url':
- lambda x, col: getattr(get_element_editor(self, x), 'url', None),
- 'data-toggle':
- lambda x, col: 'modal' if getattr(get_element_editor(self, x), 'modal_target', None)
- else None},
+ return {'tr': {'id': lambda x, col: '{0}::{1}'.format(self.id, getattr(x, '__name__', '')),
+ 'data-ams-element-name': lambda x, col: getattr(x, '__name__', None),
+ 'data-ams-url': lambda x, col: getattr(get_element_editor(self, x), 'url', None),
+ 'data-toggle': lambda x, col: 'modal' if getattr(get_element_editor(self, x), 'modal_target',
+ None) else None},
'th': {'data-ams-datatable-stype': self.get_column_type}}
batchSize = 10000
@@ -120,19 +115,19 @@
def renderTable(self):
return super(BaseTable, self).renderTable() \
- .replace('<table', '<table %s' % self.get_data_attributes('table', self))
+ .replace('<table', '<table %s' % self.get_data_attributes('table', self))
def renderRow(self, row, cssClass=None):
return super(BaseTable, self).renderRow(row, cssClass) \
- .replace('<tr', '<tr %s' % self.get_data_attributes('tr', row[0][0]))
+ .replace('<tr', '<tr %s' % self.get_data_attributes('tr', row[0][0]))
def renderHeadCell(self, column):
return super(BaseTable, self).renderHeadCell(column) \
- .replace('<th', '<th %s' % self.get_data_attributes('th', column))
+ .replace('<th', '<th %s' % self.get_data_attributes('th', column))
def renderCell(self, item, column, colspan=0):
return super(BaseTable, self).renderCell(item, column, colspan) \
- .replace('<td', '<td %s' % self.get_data_attributes('td', item, column))
+ .replace('<td', '<td %s' % self.get_data_attributes('td', item, column))
@adapter_config(context=(IContainer, IPyAMSLayer, BaseTable), provides=IValues)