Widget 1
view.ftl
application.info
application.type=widget
application.code=ViewEntradas
application.title=Colhedores
application.description=ViewEntradas
application.category=Dataset
application.renderer=freemarker
developer.code=MC100
developer.name=Marcio
developer.url=http://www.fluig.com
application.uiwidget=true
application.mobileapp=true
application.resource.css.1=/resources/css/ViewEntradas.css
application.resource.js.2=/resources/js/ViewEntradas.js
view.file=view.ftl
edit.file=edit.ftl
ViewEntradas.js
var ViewEntradas = SuperWidget.extend({
init: function() {
var arrayEntradas = [];
var datasetReturned = DatasetFactory.getDataset("dsEntradas", null, null, null);
if (datasetReturned != null && datasetReturned.values != null && datasetReturned.values.length > 0)
{
var records = datasetReturned.values;
for ( var index in records) {
var record = records[index];
arrayEntradas.push({
AC : record.AC,
Contrato: record.Contrato,
Varied : record.Varied,
Caixas : record.Caixas,
Talhao : record.Talhao,
Ratio : record.Ratio,
Solido : record.Solido,
FrCx : record.FrCx,
Brix : record.Brix,
CxTon : record.CxTon,
Regiao : record.Regiao
});
}
};
var myTable = FLUIGC.datatable('#viewDataset', {
dataRequest: arrayEntradas,
renderContent: ['AC', 'Contrato', 'Varied', 'Caixas', 'Talhao', 'Ratio', 'Solido', 'FrCx', 'Brix', 'CxTon', 'Regiao'],
header: [
{'title': 'AC', 'dataorder': 'AC',},
{'title': 'Contrato'},
{'title': 'Varied'},
{'title': 'Caixas'},
{'title': 'Talhao'},
{'title': 'Ratio'},
{'title': 'Solido'},
{'title': 'FrCx'},
{'title': 'Brix'},
{'title': 'CxTon'},
{'title': 'Regiao'}
],
search: {
enabled: true,
onlyEnterkey: false,
searchAreaStyle: 'col-md-6',
onSearch: function(res) {
myTable.reload(myTable.getData());
if (res) {
var data = myTable.getData();
var search = data.filter(function(el) {
return el.turma.toUpperCase().indexOf(res.toUpperCase()) >= 0;
});
myTable.reload(search);
}
}
},
}, function(err, data) {
if (err) {
FLUIGC.toast({
message: err,
type: 'danger'
});
}
});
},
reload: function(el, ev) {
this.myTable.reload();
}
});
**Widget 2
View.ftl**
application.info
application.type=widget
application.code=ViewAusencias
application.title=Ausências
application.description=Ausências por Coordenador
application.category=DataSet
application.renderer=freemarker
developer.code=MC100
developer.name=Marcio
developer.url=http://www.fluig.com
application.uiwidget=true
application.mobileapp=true
view.file=view.ftl
edit.file=edit.ftl
application.resource.css.3=/resources/css/ViewAusencias.css
application.resource.js.4=/resources/js/ViewAusencias.js
ViewAusencias.js
var ViewAusencias = SuperWidget.extend({
init: function() {
var arrayEntradas = [];
var datasetReturned1 = DatasetFactory.getDataset("dsColAusencias", null, null, null);
if (datasetReturned1 != null && datasetReturned1.values != null && datasetReturned1.values.length > 0)
{
var records = datasetReturned1.values;
for ( var index in records) {
var record = records[index];
arrayEntradas.push({
Coordenador : record.Coordenador,
Baixa : record.BAIXA,
Alerta : record.ALERTA,
Elevada : record.ELEVADA,
Percentual : record.PERCENTUAL
});
}
};
var myTable1 = FLUIGC.datatable('#viewDataset', {
dataRequest: arrayEntradas,
renderContent: ['Coordenador', 'Baixa', 'Alerta', 'Elevada', 'Percentual'],
header: [
{'title': 'Coordenador', 'dataorder': 'Coordenador',},
{'title': 'Baixa'},
{'title': 'Alerta'},
{'title': 'Elevada'},
{'title': 'Percentual'}
],
search: {
enabled: true,
onlyEnterkey: false,
searchAreaStyle: 'col-md-6',
onSearch: function(res) {
myTable1.reload(myTable.getData());
if (res) {
var data = myTable1.getData();
var search = data.filter(function(el) {
return el.turma.toUpperCase().indexOf(res.toUpperCase()) >= 0;
});
myTable1.reload(search);
}
}
},
}, function(err, data) {
if (err) {
FLUIGC.toast({
message: err,
type: 'danger'
});
}
});
},
reload: function(el, ev) {
this.myTable1.reload();
}
});
Consegue compartilhar o código?
— Marcos Jahn 08 de Jan de 2018