aldeed / meteor-cfs-autoform

Upload files using CollectionFS as part of AutoForm submission
MIT License
37 stars 32 forks source link

How to subscribe cfs-files #61

Open jaganreddy opened 7 years ago

jaganreddy commented 7 years ago

I defined in Ads schema

images: {
    type: [String],
    optional: true,
    label: "Pictures",
    autoform: {
      afFieldInput: {
        type: "cfs-files",
        collection: "images"
      }
    }
  },

At server publish

new Meteor.Pagination(Ads,{
    transform_options: function (filters, options) {
        const fields = { "images":1,"adlocation":1,"title":1,"slug":1 }
        options.fields = _.extend(fields, options.fields);
        return options;
    }
});

at client side subscription

this.pagination = new Meteor.Pagination(Ads, {
    sort: {
                    _id: -1
            },
        perPage: 1,
        filters:conditions,
        fields:{"images":1,"adlocation":1,"title":1,"slug":1}
  });

How to subscribe images based on Ads pagination.

Regards, Jagan