Skip to content

Instantly share code, notes, and snippets.

@gootyfer
Created July 23, 2012 09:02
Show Gist options
  • Save gootyfer/3162734 to your computer and use it in GitHub Desktop.
Save gootyfer/3162734 to your computer and use it in GitHub Desktop.
Space update problem
//Update data in the space
space.getSubResources({
relation: openapp.ns.role+"data",
type: "classon:question",
onAll: function(arr){
var found = false;
for(var i=0; i<arr.length; i++){
if(arr[i].uri == question.id){
//Set representation IS NOT WORKING!!!!!
arr[i].setRepresentation({
description : question.description,
votes: question.votes
}, "rdfjson",function(sub){
console.log("UPDATED RESOURCE");
console.log(sub);
//Sent intent
publishResourceUpdate(question, "ACTION_UPDATE");
//Update UI
//show_questions();
});
console.log("Resource Found! uri:"+question.id);
found = true;
break;
}
}
if(!found){
console.log("Resource NOT Found! uri:"+question.id);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment