Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Alloy custom adapter: sending data to server before fetching details

$
0
0

I have been trying alloy custom adapter given in the documentation

https://github.com/appcelerator-developer-relations/BookClient/blob/master/app/lib/alloy/sync/book_rest.js

in which we are overriding backbone sync method. I have a case in which I want to fetch book collection as in the example.But my problem is I want to sent additional details such as userid with url for fetching data from server.i.e books read by user.I have userid passed from previous controller.

I want to pass this userid to custom rest adapter while fetching data from server. How I can pass this additional parameter to the server through sync adapter?

I tried to set a model with userid using model.set() and saved the model using model.save() and added it to collection .I tried to access it through

module.exports.sync = function(method, model, options) {

var userId = model.get("üserid"); alert(userId)

}

In model.save() sync method I am getting userid value inside adapter but when I am using collection.fetch I am not getting userid value.Is there any way to pass these values to adapter ?

Thanks in advance

Vivek P


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>