orionjs / orioncms

[Old] Orion is an open source framework built on Meteor that makes complex as well as simple apps possible with minimal effort.
http://orionjs.org
MIT License
715 stars 129 forks source link

How to do subsribe for backend managment page? #385

Open thinksource opened 8 years ago

thinksource commented 8 years ago

For example on product management page, I want to subscribe category:

ProductCol.attachSchema(new SimpleSchema({
  title: {
    type: String,
    label: orion.helpers.getTranslation('ProductCol.schema.title') // We use this function to make i18n work in autoform
  },

  mpn:{
    type:String,
    label:"manufacture product number"
  },
  category:{
    type:[String],
    label: "sub category",
    autoform: {
      options: function () {
        Meteor.subscribe("categoriesList");
        var results=CateCol.find({}).fetch();
        var re=[];
        for(var i=0; i<results.length;i++){
          var tmp={'label':results[i].label,'value':results[i].value}
          re.push(tmp);
        }
        console.log(re);
        return re;
      }
    }
  },
....

The CateCol catch empty list. I already publish the Catecol manually at the server side. can you give me an example how to make the dynamic select option(category) on backend product management?