Add basic paging grid/index support for mobile

still lots to do for this yet..but readonly basics are here..
This commit is contained in:
Lance Edgar 2017-03-30 20:11:17 -05:00
parent e313e1bc8c
commit 0ad29c5283
7 changed files with 132 additions and 57 deletions

View file

@ -108,7 +108,12 @@
% endfor
% endif
% if capture(self.page_title):
% if master is not Undefined and master.listing:
<h1>${model_title_plural}</h1>
% elif index_title is not Undefined and index_url is not Undefined:
<h1>${h.link_to(index_title, index_url)}</h1>
<h2>${self.page_title()}</h2>
% elif capture(self.page_title):
<h2>${self.page_title()}</h2>
% endif

View file

@ -10,7 +10,38 @@
<%def name="title()">${model_title_plural}</%def>
<ul data-role="listview">
% for obj in grid:
<li>${grid.render_object(obj)}</li>
% for obj in grid.iter_rows():
<li>${grid.listitem.render_readonly()}</li>
% endfor
</ul>
## <table data-role="table" class="ui-responsive table-stroke">
## <thead>
## <tr>
## % for column in grid.iter_visible_columns():
## ${grid.column_header(column)}
## % endfor
## </tr>
## </thead>
## <tbody>
## % for i, row in enumerate(grid.iter_rows(), 1):
## <tr>
## % for column in grid.iter_visible_columns():
## <td>${grid.render_cell(row, column)}</td>
## % endfor
## </tr>
## % endfor
## </tbody>
## </table>
% if grid.pageable and grid.pager:
<br />
<div data-role="controlgroup" data-type="horizontal">
${grid.pager.pager('$link_first $link_previous $link_next $link_last',
symbol_first='<< first', symbol_last='last >>',
symbol_previous='< prev', symbol_next='next >',
link_attr={'class': 'ui-btn ui-corner-all'},
curpage_attr={'class': 'ui-btn ui-corner-all'},
dotdot_attr={'class': 'ui-btn ui-corner-all'})}
</div>
% endif

View file

@ -7,6 +7,6 @@
## ##############################################################################
<%inherit file="/mobile/base.mako" />
<%def name="title()">${model_title}: ${instance_title}</%def>
<%def name="title()">${instance_title}</%def>
<p>TODO: display fieldset for object</p>
${form.render()|n}