#Extending quick search to default filter to search by custom field#
This customization allows to user to search by another field aside name field
// Nombre del modulos a consultar | |
var moduleName = "T01_Telefonos"; | |
// Filtros que se desean aplicar | |
var filters = [ | |
// Se va a filtrar por la relacion que tiene el modulo con cuentas | |
{t01_telefonos_accountsaccounts_ida: "eff78d90-03c1-dbd0-fe8e-55f060047d98"} | |
]; | |
// Se crea un collecion del modulo, el cual se va a llenar cuando el api nos de respuesta | |
var telCollection = App.data.createBeanCollection(moduleName); | |
// Se realiza la peticion |
({ | |
events:{ | |
'click .button': '_createMeeting', | |
}, | |
_createMeeting: function(){ | |
var meeting = app.data.createBean('Meetings'); | |
meeting.set({ | |
// Create its UUID | |
id: app.utils.generateUUID(), | |
name: 'Test', |
({ | |
events:{ | |
'click button': '_handlerClick', | |
}, | |
_handlerClick: function(evt, el){ | |
var modelPrefil = app.data.createBean("Accounts"); | |
modelPrefil.set({ | |
name: "Account name", | |
assigned_user_name: 1 | |
}); |
({ | |
initialize: function(){ | |
this._super("initialize", arguments); | |
var field = this.getField('field_name'); | |
field.setMode('readonly'); | |
field.setMode('edit'); | |
field.setMode('detail'); | |
} | |
}) |
#Extending quick search to default filter to search by custom field#
This customization allows to user to search by another field aside name field
({ | |
showPreview: function(moduleName, modelId){ | |
var bean = App.data.createBean(moduleName, {id:modelId}); | |
bean.fetch(); | |
App.events.trigger('preview:render', bean); | |
} | |
}) |
({ | |
getRecordsRecursive: function(moduleName, filters, offset, collectionBuffer, callback){ | |
var self = this; | |
if(offset > -1){ | |
var collection = App.data.createBeanCollection(moduleName); | |
var req = collection.fetch({"filter": filters, "offset": offset}); | |
req.xhr.success(function(data){ | |
if(data.records){ | |
collectionBuffer.add(data.records); | |
self.getRecordsRecursive(moduleName, filters, data.offset, collectionBuffer, callback); |
test
/* | |
* Your installation or use of this SugarCRM file is subject to the applicable | |
* terms available at | |
* http://support.sugarcrm.com/06_Customer_Center/10_Master_Subscription_Agreements/. | |
* If you do not agree to all of the applicable terms or do not have the | |
* authority to bind the entity as an authorized representative, then do not | |
* install or use this SugarCRM file. | |
* | |
* Copyright (C) SugarCRM Inc. All rights reserved. | |
*/ |
({ | |
plugins: ['Dashlet'], | |
initialize: function (options) { | |
var self = this; | |
this._super('initialize', [options]); | |
// Escuchador que se detona cuando se ha detectado que el api de | |
self.context.on('google:maps:api:load', _.bind(self._googleMapsApiLoadHandler, self)); | |
// Se define la función callback que se va a ejecutar cuando google maps api ya esta disponible | |
window.mapsApiCallback = function(){ | |
console.log('hola mundo, maps api cargado'); |