Strngs / comet

An Extensible Admin Panel for Meteor
https://atmospherejs.com/strngs/comet
Other
2 stars 2 forks source link

basic formatters? #13

Closed dcsan closed 9 years ago

dcsan commented 9 years ago

meteor admin breaks as soon as you have a few hundred rows so I wanted to try your datatables version of Comet asap

but a bit confused about all the formatter requirements and the setup time for every single item having a unique render method. https://github.com/WillHall/meteor-admin/blob/master/lib/both/AdminDashboard.coffee

is there a generic formatter that will just display text, much like meteor-admin does now? Since this is only the table view, i dont want to spend hours configuring it or writing custom methods.

WillHall commented 9 years ago

if you do not specify a render callback it will just display the value.

dcsan commented 9 years ago

got it. i also realized that 'editable' or 'deletable' can be made as reusble elements, as there's nothing table specific. adding that as a flag outside the group might be better.

editable = {
  title: 'Edit'
  data:'_id'
  render: CometDashboard.formatters.edit
  sortable: false, width: '5%', class: 'text-center'
}

deletable = {
  title: 'Delete', data:'_id',
  render: CometDashboard.formatters.del,
  sortable: false, width: '5%', class: 'text-center'
}

config = {
  collections: {

    Topics: {
      icon: 'mortar-board'
      color: 'green'
      omitFields: ['updatedAt', 'editor', 'userId']
      # editable: true   <--- do this instead

      tableColumns: [
        {name: 'level', label: 'level'}
        {name: 'cname', label:'cname' }
        {name: 'stype', label:'stype' }
        {name: 'tl', label:'tl - target language of topic' }
        editable  # reused
        deletable
      ]
    }

    Notes: {
      icon: 'mortar-board'
      color: 'green'
      omitFields: ['updatedAt', 'editor', 'userId']
      tableColumns: [
        {name: 'topicCname', label: 'topicCname' }
        {name: 'order', label: 'order' }
        {name: 'tl', label: 'tl' }
        {name: 'hl', label: 'hl' }
        editable
        deletable
      ]
    }
WillHall commented 9 years ago

I can add that as an option.

dcsan commented 9 years ago

FWIW it seems like the delete is broken in the version of this which is in atmosphere.

WillHall commented 9 years ago

really? On a custom collection or just in general?

WillHall commented 9 years ago

There is a task open for this now https://github.com/Strngs/comet/issues/14

I will be sure to investigate the report of broken delete functionality.