Created
July 23, 2012 09:02
-
-
Save gootyfer/3162734 to your computer and use it in GitHub Desktop.
Space update problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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