Client: Difference between revisions
From MobileX for SageCRM
Crmtogether (talk | contribs) (Created page with " The client plugin is created in the file "SageCRMWS/js/plugins/PLUGINNAME/client/plugin.js" You would add the following: var onDocumentReady = function () { } var onC...") |
Crmtogether (talk | contribs) No edit summary |
||
| Line 10: | Line 10: | ||
This is the basic setup of the client plugin | This is the basic setup of the client plugin | ||
onDocumentReady - Called when the web application has finished loading. | |||
onContextChanged - Called when a context in the web application has changed, as the result of calling cApp.setContext() method. | |||
Next thing we might want to do is create a button the screen. | |||
var onContextChanged = function () { | |||
// Add "Orders" tab to the Company Summary | |||
if (cApp.EntityName == "company") { | |||
Factory.destroyComponent("btnOrders"); | |||
cApp.btnOrders= Factory.createTopButton("btnOrders"); | |||
cApp.btnOrders.pr_caption = "Order"; | |||
cApp.btnOrders.pr_icon = "icon-envelope icon-white"; | |||
cApp.btnOrders.pr_onclick = "cApp.sendOrder();"; | |||
cApp.btnOrders.pr_insert = true; | |||
cApp.btnOrders.draw("btnContainer"); | |||
cApp.btnOrders.position(255, 2); | |||
} | |||
}; | |||
Our client API uses the Factory method to control creating elements. | |||
See Factory | |||
Revision as of 11:35, 28 June 2016
The client plugin is created in the file "SageCRMWS/js/plugins/PLUGINNAME/client/plugin.js"
You would add the following:
var onDocumentReady = function () {
}
var onContextChanged = function () {
};
This is the basic setup of the client plugin
onDocumentReady - Called when the web application has finished loading. onContextChanged - Called when a context in the web application has changed, as the result of calling cApp.setContext() method.
Next thing we might want to do is create a button the screen.
var onContextChanged = function () {
// Add "Orders" tab to the Company Summary
if (cApp.EntityName == "company") {
Factory.destroyComponent("btnOrders");
cApp.btnOrders= Factory.createTopButton("btnOrders");
cApp.btnOrders.pr_caption = "Order";
cApp.btnOrders.pr_icon = "icon-envelope icon-white";
cApp.btnOrders.pr_onclick = "cApp.sendOrder();";
cApp.btnOrders.pr_insert = true;
cApp.btnOrders.draw("btnContainer");
cApp.btnOrders.position(255, 2);
}
};
Our client API uses the Factory method to control creating elements.
See Factory