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
| Ext.define("PocketCRM.store.Leads", { | |
| extend: "Ext.data.Store", | |
| requires: "Ext.data.proxy.LocalStorage", | |
| config: { | |
| model: "PocketCRM.model.Lead", | |
| //Fetch the data from the custom Apex controller method | |
| //which will return a simple list of Leads as JSON on load. |
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
| public with sharing class PocketCRMLeadController { | |
| public PocketCRMLeadController() {} | |
| //======================================================================== | |
| //INNER CLASSES | |
| //These support data request/response transport for remoting. | |
| //======================================================================== | |
| // One of the parameters supplied by the DirectProxy read method. |
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
| //The Lead model will include whatever fields are necssary to manage. | |
| Ext.define("PocketCRM.model.Lead", { | |
| extend: "Ext.data.Model", | |
| config: { | |
| idProperty: 'Id', | |
| fields: [ | |
| { | |
| name: 'Id', |
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
| ... | |
| limitParam: 'recordCount', // maps to QueryRequest.recordCount | |
| ... | |
| } | |
| (Apex) | |
| public class QueryRequest { | |
| ... | |
| Integer recordCount; | |
| ... |
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
| {"action":"PocketCRMLeadController","method":"Edit","data":[[{"LastName":"Rogers","Id":"00Q5000000TXUh7EAH"}]],"type":"rpc","tid":8,"ctx":{"csrf":"RJwzNCf17ZNm_6plAMNqSGf5xEWfwVJcR4CPtjMVb4a2g38HryRgL0jyVfAn2GNyUSd.PHPwsl5sptP607AXKgFvCnGIKGLnvExkZV9ILTLCHMNdIjTHsdKYMwVYe2JNSfnZ8THOvpEld6_.px3lKp3rcx_q7NAX1oClG13LQCYR1BY_","vid":"06650000000D9rZ","ns":"","ver":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
| onSaveLeadCommand: function () { | |
| console.log("onSaveLeadCommand");... | |
| //Check for validation errors. | |
| var errors = currentLead.validate(); | |
| if (!errors.isValid()) { | |
| var msg = ''; | |
| errors.each(function (error) { | |
| msg += error.getMessage() + '<br/>'; |
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
| validations: [ | |
| { type: 'presence', field: 'LastName', message: 'Enter a last name.' }, | |
| ... |
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
| // Base Class functions. | |
| launch: function () { | |
| console.log("launch"); | |
| this.callParent(arguments); | |
| //Load up the Store associated with the controller and its views. | |
| console.log("load Leads"); | |
| var leadsStore = Ext.getStore("Leads"); | |
| leadsStore.load(); | |
| }, |
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
| init: function () { | |
| this.callParent(arguments); | |
| console.log("init"); | |
| //Listen for exceptions observed by the proxy so we can report them and clean up. | |
| //20121016 Fixed for bug on improper object references | |
| Ext.getStore('Leads').getProxy().addListener('exception', function (proxy, response, operation, options) { | |
| // only certain kinds of errors seem to have useful information returned from the server | |
| if (response) { | |
| if (response.errorMessage) { |
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
| //Adjust our read method to add a function that Touch expects to see to get Arguments. | |
| PocketCRMLeadController.Query.directCfg.method.getArgs = function (params, paramOrder, paramsAsHash) { | |
| console.log('getArgs: ' + params.data); | |
| return [params] | |
| } |