Posted By

abhinavguptas on 03/26/11


Tagged

Apex


Versions (?)

Apex Controller for Javascript Remoting Sample


 / Published in: Java
 

URL: http://snipplr.com/view/51124/editable-account-grid-using-visualforce-javascript-remoting--jquery-templates/

The matching visualforce page code can be found here : http://snipplr.com/view/51124/editable-account-grid-using-visualforce-javascript-remoting--jquery-templates/

  1. public global with sharing class testremotingcontroller {
  2. @RemoteAction
  3. global static Account[] searchAccounts(String accountName) {
  4. // Search accounts for the account name passed from Javascript
  5. accountName = accountName.replaceAll('[*]', '%');
  6. return [select id, name, phone, type, numberofemployees from
  7. Account where name like :accountName ];
  8. }
  9.  
  10. @RemoteAction
  11. global static boolean updateAccount(String accountId, String phoneNum) {
  12. // update account for the accountId and phone-number passed from Javascript
  13. update new Account(Id = accountId, Phone = phoneNum);
  14. return true;
  15. }
  16. }

Report this snippet  

You need to login to post a comment.