javascript - How do i Meteor Reset client subscription -


मैंने इस तरह सदस्यता लिया है और इस तरह प्रकाशित करें:

publish.js:

  Meteor.publish ('ProductWithSkipAndLimit', फ़ंक्शन (छोड़ें, सीमा) {वापसी उत्पाद.फिंड ({}, {sort: {createdAt: 1}, skip: skip, limit: limit});});   

subscribe.js: <पूर्व> Meteor.subscribe ('ProductWithSkipAndLimit', 0,10);

और यह क्लाइंट से वापस 10 उत्पादों के आधार पर क्रमबद्ध होगा। नहीं, मेरे पास इस पर एक इवेंट क्लिक है:

  'click': function (e) {e.preventDefault (); Meteor.subscribe ( 'ProductWithSkipAndLimit', 10,10); }   

मुझे 10 और उत्पाद प्राप्त करना है ठीक है मैं उस उत्पादों को मिलता है, लेकिन 10 उत्पादों रीसेट नहीं इसलिए क्लाइंट पर मेरे पास 20 प्रॉडक्ट हैं।

कैसे मैं ग्राहक सदस्यता रीसेट कर सकता हूँ? इसलिए ग्राहक के पास केवल 10 उत्पादों का प्रत्येक सदस्य होता है।

Meteor.subscribe:

< P> एक रिकॉर्ड सेट की सदस्यता लें। एक हैंण्डल देता है जो रोक () और तैयार () तरीके प्रदान करता है।

आपको Meteor.subscribe के संभाल लेने की आवश्यकता है

  subscription = Meteor.subscribe ( 'ProductWithSkipAndLimit', 10,10);   

और ईवेंट ऑब्जेक्ट में:

  var सदस्यता; Template.NAME.events ({'click': function (e) {e.preventDefault (); सदस्यता और amp; सदस्यता। रोक (); सदस्यता = मेटीर। सदस्यता ('उत्पादविथस्कीप एंडलिमिट', 10,10);}} )    

Comments

Popular posts from this blog

c# - Roxy file manager in MVC doesn't accept session path -

jsp - No mapping found for HTTP request with URI with annotation config Spring MVC and Jetty -

java - Ajax call to jsp and jsp redirecting to further jsp -