Changeset 05b8ed7 in tailbone


Ignore:
Timestamp:
03/28/19 23:09:10 (11 months ago)
Author:
Lance Edgar <ledgar@…>
Branches:
master
Children:
8ee20e5
Parents:
24547b4
Message:

Add support for "row status" in Buefy grid tables

Location:
tailbone
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • tailbone/grids/core.py

    r24547b4 r05b8ed7  
    10281028        raw_data = self.make_visible_data()
    10291029        data = []
     1030        status_map = {}
    10301031
    10311032        # iterate over data rows
     
    10501051            self.set_action_urls(row, rowobj, i)
    10511052
     1053            status = self.extra_row_class(rowobj, i)
     1054            if status:
     1055                status_map[i] = status
     1056
    10521057            data.append(row)
    10531058
    10541059        results = {
    10551060            'data': data,
     1061            'row_status_map': status_map,
    10561062        }
    10571063
  • tailbone/templates/grids/buefy.mako

    r24547b4 r05b8ed7  
    66     :columns="columns"
    77     :loading="loading"
     8     :row-class="getRowClass"
    89
    910     :default-sort="[sortField, sortOrder]"
     
    2223     ## TODO: should let grid (or master view) decide how to set these?
    2324     icon-pack="fas"
    24      :striped="true"
     25     ## note that :striped="true" was interfering with row status (e.g. warning) styles
     26     :striped="false"
    2527     :hoverable="true"
    2628     :narrowed="true">
     
    8284              sortField: '${grid.sortkey}',
    8385              sortOrder: '${grid.sortdir}',
     86              rowStatusMap: ${json.dumps(grid_data['row_status_map'])|n},
    8487              % if grid.pageable:
    8588              % if static_data:
     
    97100      methods: {
    98101
     102          getRowClass(row, index) {
     103              return this.rowStatusMap[index]
     104          },
     105
    99106          loadAsyncData() {
    100107
     
    110117              this.$http.get(`${request.current_route_url(_query=None)}?${'$'}{params}`).then(({ data }) => {
    111118                  this.data = data.data
     119                  this.rowStatusMap = data.row_status_map
    112120                  this.total = data.total_items
    113121                  this.firstItem = data.first_item
  • tailbone/templates/themes/falafel/base.mako

    r24547b4 r05b8ed7  
    325325  ${h.stylesheet_link(request.static_url('tailbone:static/themes/falafel/css/layout.css') + '?ver={}'.format(tailbone.__version__))}
    326326  ${h.stylesheet_link(request.static_url('tailbone:static/css/grids.css') + '?ver={}'.format(tailbone.__version__))}
     327  ${h.stylesheet_link(request.static_url('tailbone:static/themes/falafel/css/grids.rowstatus.css') + '?ver={}'.format(tailbone.__version__))}
    327328##   ${h.stylesheet_link(request.static_url('tailbone:static/css/filters.css') + '?ver={}'.format(tailbone.__version__))}
    328329  ${h.stylesheet_link(request.static_url('tailbone:static/themes/bobcat/css/forms.css') + '?ver={}'.format(tailbone.__version__))}
Note: See TracChangeset for help on using the changeset viewer.