Hello guys, i'm new so i'm doing an extension and i want to capture data from options(like change() method from jquery) and parse it through client's controller, so i want to know the proper way to do this:
client>modules>location>src>views>location>index.j s
client>modules>location>src>controllers>location>l ocation.js
this is de data i want to capture:
application>espo>modules>location>resources>client Defs>location.json
application>espo>modules>location>resources>layout s>detail.json
how do i create my template in client>modules>location>res>templates>location>ind ex.tpl ?
client>modules>location>src>views>location>index.j s
PHP Code:
Espo.define('location:views/location/index', 'view', function (Dep) {
return Dep.extend({
template: 'location:location/index',
setup: function() {
Dep.prototype.setup.call(this);
this.listenTo(this.model, 'change', function() {
this.captureData();
this.reRender();
});
},
captureData: function() {
console.log("captureData");
}
})
});
PHP Code:
Espo.define('location:controllers/location', 'controller', function (Dep) {
return Dep.extend({
getSettingsModel: function () {
var model = this.getConfig().clone();
model.defs = this.getConfig().defs;
return model;
},
index: function (options) {
var model = this.getSettingsModel();
this.main('location:views/location/index', {
model: model
});
}
});
});
application>espo>modules>location>resources>client Defs>location.json
PHP Code:
{
"fields": {
"map_canvas": {
"type": "varchar"
},
"country": {
"options": ["all", "country1", "country2"]
},
"type": {
"options": ["all", "type1", "type2"]
}
}
}
PHP Code:
[
{
"label":"Filter",
"rows": [
[
{"name":"country","fullWidth": false},
{"name":"type","fullWidth": false}
]
]
},
{
"label":"Details",
"rows": [
[{"name":"data","fullWidth": true}]
]
}
]
Comment