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 class PocketCRMLeadController { | |
| private string leads; | |
| //Constructor. | |
| public PocketCRMLeadController() { | |
| //Fetch a limited set of Leads to return to the Sencha Data Store on load. | |
| List < Lead > leadsList = [SELECT | |
| FirstName | |
| , LastName |
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
| <apex:component controller="PocketCRMLeadController" > |
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 Store, this version will simply load with mock JSON data. | |
| 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 |
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
| https://c.{SERVER_NAME}.visual.force.com/apex/PocketCRM |
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 list view. | |
| Ext.define("PocketCRM.view.LeadsList", { | |
| extend: "Ext.Container", | |
| //It uses the base list class. | |
| requires: "Ext.dataview.List", | |
| alias: "widget.leadslistview", | |
| config: { |
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.view.LeadEditor", { | |
| extend: "Ext.form.Panel", | |
| requires: "Ext.form.FieldSet", | |
| alias: "widget.leadeditorview", | |
| config: { | |
| scrollable: 'vertical', | |
| items: [{ |
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.application({ | |
| name: "PocketCRM", | |
| //Load the various MVC components into memory. | |
| models: ["Lead"], | |
| stores: ["Leads"], | |
| controllers: ["Leads"], | |
| views: ["LeadsList", "LeadEditor"], |
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
| config: { | |
| refs: { | |
| // We're going to lookup our views by alias. | |
| leadsListView: "leadslistview", | |
| leadEditorView: "leadeditorview", | |
| leadsList: "#leadsList" | |
| }, | |
| control: { |
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
| slideLeftTransition: { | |
| type: 'slide', | |
| direction: 'left' | |
| }, | |
| slideRightTransition: { | |
| type: 'slide', | |
| direction: 'right' | |
| }, | |
| //View Transition Helper functions |
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
| onSyncLeadCommand: function () { | |
| console.log("onSyncLeadCommand"); | |
| //Get a ref to the store and remove it. | |
| var leadsStore = Ext.getStore("Leads"); | |
| //Resync the proxy, reload and activate the list. | |
| leadsStore.sync(); | |
| leadsStore.load(); | |
| this.activateLeadsList(); |