Created
March 14, 2012 20:37
-
-
Save joshbirk/2039328 to your computer and use it in GitHub Desktop.
Super simple SOQL/JS Remoting
This file contains hidden or 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
| function filterQuarks(spin,mass) { | |
| remoteTest.filterQuarks(spin,mass,updateResults); | |
| remoteTest.testDouble(logTemperatures); | |
| } | |
| function logTemperatures(result, event) { | |
| console.log(result); | |
| } | |
| function updateResults(result, event) { | |
| j$('#sizeOfUniverse').html(result.length); | |
| j$('canvas.test').clearCanvas(); | |
| var centerX = 650/2; | |
| var centerY = 450/2; | |
| var quad = 1; | |
| for(var i = 0; i < result.length; i++) { | |
| if(result[i].Spin__c <= 0.25) { | |
| x = centerX + i; | |
| y = centerY + i; | |
| } | |
| else if(result[i].Spin__c <= 0.50) { | |
| x = centerX + i; | |
| y = centerY - i; | |
| } | |
| else if(result[i].Spin__c <= 0.75) { | |
| x = centerX - i; | |
| y = centerY + i; | |
| } | |
| else { | |
| x = centerX - i; | |
| y = centerY - i; | |
| } | |
| j$('canvas.test').drawArc({ | |
| fillStyle: '#333', | |
| x: x, y: y, | |
| radius: result[i].Mass__c * 7.25, | |
| }); | |
| } | |
| } |
This file contains hidden or 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
| //GET Quarks via RemoteAction | |
| @RemoteAction | |
| global static List<Quark__c> filterQuarks(Decimal spin, Decimal mass) { | |
| List<Quark__c> quarks = [SELECT ID, Name, Spin__c, Mass__c, Color_Charge__c from Quark__c WHERE Spin__c < :spin AND Mass__c < :mass]; | |
| return quarks; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment