another iteration to col/colgroup in grid, thanks Anthony for advice
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 2.7.4-stable+timestamp.2013.11.02.10.08.01
|
Version 2.7.4-stable+timestamp.2013.11.03.09.25.26
|
||||||
|
|||||||
+8
-1
@@ -2297,14 +2297,18 @@ class SQLFORM(FORM):
|
|||||||
headcols.append(TH(header, _class=ui.get('default')))
|
headcols.append(TH(header, _class=ui.get('default')))
|
||||||
|
|
||||||
toadd = []
|
toadd = []
|
||||||
|
left_cols = 0
|
||||||
|
right_cols = 0
|
||||||
if links and links_in_grid:
|
if links and links_in_grid:
|
||||||
for link in links:
|
for link in links:
|
||||||
if isinstance(link, dict):
|
if isinstance(link, dict):
|
||||||
toadd.append(TH(link['header'], _class=ui.get('default')))
|
toadd.append(TH(link['header'], _class=ui.get('default')))
|
||||||
if links_placement in ['right', 'both']:
|
if links_placement in ['right', 'both']:
|
||||||
headcols.extend(toadd)
|
headcols.extend(toadd)
|
||||||
|
right_cols += len(toadd)
|
||||||
if links_placement in ['left', 'both']:
|
if links_placement in ['left', 'both']:
|
||||||
linsert(headcols, 0, toadd)
|
linsert(headcols, 0, toadd)
|
||||||
|
left_cols += len(toadd)
|
||||||
|
|
||||||
# Include extra column for buttons if needed.
|
# Include extra column for buttons if needed.
|
||||||
include_buttons_column = (details or editable or deletable or
|
include_buttons_column = (details or editable or deletable or
|
||||||
@@ -2313,8 +2317,10 @@ class SQLFORM(FORM):
|
|||||||
if include_buttons_column:
|
if include_buttons_column:
|
||||||
if buttons_placement in ['right', 'both']:
|
if buttons_placement in ['right', 'both']:
|
||||||
headcols.append(TH(_class=ui.get('default','')))
|
headcols.append(TH(_class=ui.get('default','')))
|
||||||
|
right_cols += 1
|
||||||
if buttons_placement in ['left', 'both']:
|
if buttons_placement in ['left', 'both']:
|
||||||
headcols.insert(0, TH(_class=ui.get('default','')))
|
headcols.insert(0, TH(_class=ui.get('default','')))
|
||||||
|
left_cols += 1
|
||||||
|
|
||||||
head = TR(*headcols, **dict(_class=ui.get('header')))
|
head = TR(*headcols, **dict(_class=ui.get('header')))
|
||||||
|
|
||||||
@@ -2414,7 +2420,8 @@ class SQLFORM(FORM):
|
|||||||
cols = [COL(_id=str(c).replace('.','-'),data={'position':i+1})
|
cols = [COL(_id=str(c).replace('.','-'),data={'position':i+1})
|
||||||
for i,c in enumerate(columns)]
|
for i,c in enumerate(columns)]
|
||||||
n = len(head.components)
|
n = len(head.components)
|
||||||
cols += [COL(data={'position':i+1}) for i in range(len(cols),n)]
|
cols = [COL() for i in range(left_cols)] + cols + [
|
||||||
|
COL() for i in range(right_cols)]
|
||||||
htmltable = TABLE(COLGROUP(*cols),THEAD(head))
|
htmltable = TABLE(COLGROUP(*cols),THEAD(head))
|
||||||
tbody = TBODY()
|
tbody = TBODY()
|
||||||
numrec = 0
|
numrec = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user