@Matheus,
Exemplo usando datasets com o Mustache:
var datasetReturned = DatasetFactory.getDataset("ds_FeedsClientes", null, null, null);
var records = datasetReturned.values;
that.mydata = [];
for (var index in records) {
var record = records[index];
that.mydata.push({
feedId: record.documentid,
noResults: false
});
}
that.datatable = FLUIGC.datatable('[data-table-fluig-feeds]', {
emptyMessage: '<h4>Sem resultados de feeds</h4>',
dataRequest: that.mydata,
renderContent: '.tpl_table_row_feed',
header: [{
'title': 'Código',
'size': 'col-md-2',
'display': false
}, {
'title': 'Ambiente',
'size': 'col-md-1',
'display': false
}],
multiSelect: true,
search: {
searchAreaStyle: 'col-md-3',
enabled: true,
onlyEnterkey: true,
onSearch: function(res) {
if (!res) {
that.datatable.reload(that.mydata);
}
var dataAll = that.datatable.getData();
var search = dataAll.filter(function(el) {
return (el.feedNome !== undefined && el.feedNome.toUpperCase().indexOf(res.toUpperCase()) >= 0);
});
if (search && search.length) {
that.datatable.reload(search);
} else {
FLUIGC.toast({
title: 'Procurando: ',
message: 'Sem resultados',
type: 'success'
});
}
}
},
actions: {
enabled: true,
template: '.template_buttons_feed_area',
actionAreaStyle: 'col-md-9'
},
scroll: {
enabled: true,
target: '.tpl_table_row_feed'
},
}, function (err, data) {
if (err) {
FLUIGC.toast({
message: "Erro ao carregar dados",
type: 'danger'
});
return;
}
});
that.datatable.on('fluig.datatable.loadcomplete', function () {
if (!that.datatable) {
that.datatable = that.datatable.getData();
}
});