Beispiel #1
0
 def update_grid(self, grid, *args, **kwargs):
     metadatas = ('width', 'align', 'fixed', 'search', 'stype', 'searchoptions')
     for field in grid.render_fields.values():
         metadata = dict(search=0, sortable=1, id=field.key, name=field.key)
         searchoptions = dict(sopt=['eq', 'cn'])
         if field.is_relation:
             metadata.update(width=100, sortable=0)
         elif isinstance(field.type, (utils.Color, utils.Slider)):
             metadata.update(width=50, align='center')
         elif isinstance(field.type, fatypes.Text):
             field.set(renderer=renderers.ellipsys(field.renderer))
             metadata.update(search=1)
         elif isinstance(field.type, (fatypes.String, fatypes.Unicode)):
             metadata.update(search=1)
         elif isinstance(field.type, (fatypes.Date, fatypes.Integer)):
             metadata.update(width=70, align='center')
         elif isinstance(field.type, fatypes.DateTime):
             metadata.update(width=120, align='center')
         elif isinstance(field.type, fatypes.Boolean):
             metadata.update(width=30, align='center')
         if metadata['search']:
             metadata['searchoptions'] = searchoptions
         metadata = dict(json=dumps(metadata))
         metadata['label'] = dumps(field.label())
         field.set(metadata=metadata)
Beispiel #2
0
 def update_grid(self, grid, *args, **kwargs):
     metadatas = ('width', 'align', 'fixed', 'search', 'stype',
                  'searchoptions')
     for field in grid.render_fields.values():
         metadata = dict(search=0, sortable=1, id=field.key, name=field.key)
         searchoptions = dict(sopt=['eq', 'cn'])
         if field.is_relation:
             metadata.update(width=100, sortable=0)
         elif isinstance(field.type, (utils.Color, utils.Slider)):
             metadata.update(width=50, align='center')
         elif isinstance(field.type, fatypes.Text):
             field.set(renderer=renderers.ellipsys(field.renderer))
             metadata.update(search=1)
         elif isinstance(field.type, (fatypes.String, fatypes.Unicode)):
             metadata.update(search=1)
         elif isinstance(field.type, (fatypes.Date, fatypes.Integer)):
             metadata.update(width=70, align='center')
         elif isinstance(field.type, fatypes.DateTime):
             metadata.update(width=120, align='center')
         elif isinstance(field.type, fatypes.Boolean):
             metadata.update(width=30, align='center')
         if metadata['search']:
             metadata['searchoptions'] = searchoptions
         metadata = dict(json=dumps(metadata))
         field.set(metadata=metadata)
Beispiel #3
0
 def update_grid(self, grid, *args, **kwargs):
     for field in grid.render_fields.values():
         metadata = dict(search=0)
         searchoptions = dict(sopt=['eq', 'cn'])
         if field.is_relation:
             metadata.update(width=100)
         elif isinstance(field.type, fatypes.Text):
             field.set(renderer=renderers.ellipsys(field.renderer))
             metadata.update(search=1)
         elif isinstance(field.type, (fatypes.String, fatypes.Unicode)):
             metadata.update(search=1)
         elif isinstance(field.type, (fatypes.Date, fatypes.Integer)):
             metadata.update(width=70, align='"center"')
         elif isinstance(field.type, fatypes.DateTime):
             metadata.update(width=120, align='"center"')
         elif isinstance(field.type, fatypes.Boolean):
             metadata.update(width=30, align='"center"')
         if metadata['search']:
             metadata['searchoptions'] = dumps(searchoptions)
         metadata.update(field.metadata)
         field.set(metadata=metadata)
Beispiel #4
0
 def update_grid(self, grid, *args, **kwargs):
     for field in grid.render_fields.values():
         metadata = dict(search=0)
         searchoptions = dict(sopt=['eq', 'cn'])
         if field.is_relation:
             metadata.update(width=100)
         elif isinstance(field.type, fatypes.Text):
             field.set(renderer=renderers.ellipsys(field.renderer))
             metadata.update(search=1)
         elif isinstance(field.type, (fatypes.String, fatypes.Unicode)):
             metadata.update(search=1)
         elif isinstance(field.type, (fatypes.Date, fatypes.Integer)):
             metadata.update(width=70, align='"center"')
         elif isinstance(field.type, fatypes.DateTime):
             metadata.update(width=120, align='"center"')
         elif isinstance(field.type, fatypes.Boolean):
             metadata.update(width=30, align='"center"')
         if metadata['search']:
             metadata['searchoptions'] = dumps(searchoptions)
         metadata.update(field.metadata)
         field.set(metadata=metadata)