In that table they ask me to add the Course field, I could already add the column, I try to bring the result, but it does not show it to me, the course field is in the table records, I would also like to condition that if it has no course, show that you do not have, I hope your collaboration.
With the id of the user I must take the course id in the table of records, and then take the name of the course from the table courses
seintAdmin.controller('adminUsuarios', ['i18nService', 'cargaDatos', '$scope', '$uibModal', function(i18nService, cargaDatos, $scope, $uibModal){
i18nService.setCurrentLang('es');
var salida = this;
var usu = {};
var cur = {};
salida.datosTabla = {
enableRowSelection: true,
enableSelectAll: false,
multiSelect: false,
enableFiltering: true,
selectionRowHeaderWidth: 24,
rowHeight: 24,
showGridFooter:true,
paginationPageSizes: [100, 200, 500, 1000, 10000],
paginationPageSize: 100,
gridMenuShowHideColumns: false,
columnDefs: [
{name: 'id', visible: false},
{name: 'Nombre', displayName: 'Nombre', enableColumnMenu: false},
{name: 'Cedula', displayName: 'Cédula', enableColumnMenu: false},
{name: 'Empresa', displayName: 'Empresa', enableColumnMenu: false},
{name: 'FechaReg', visible: false},
{name: 'Curso:', displayName: 'Curso:', enableColumnMenu: false}
]
};
cargaTabla();
function cargaTabla() {
cargaDatos.leer('usuarios').then(function(resp){
cargaDatos.leer('registros').then(function(respReg){
cargaDatos.leer('cursos').then(function(respCur){
var resp = [];
salida.cursos = respCur;
angular.forEach(respCur, function(valor, llave){
cur[valor.id] = valor.NombreCurso;
});
angular.forEach(respReg, function(valor, llave){
cur[valor.id] = valor.NombreCurso;
});
angular.forEach(resp, function(valor, llave){
resp.push({
'id': valor.id,
'Nombre': valor.Nombre,
'Cedula': valor.Cedula,
'Empresa': valor.Empresa,
'FechaReg': valor.FechaReg,
'Curso': cur[valor.CodCurso]
});
});
});
salida.datosTabla.data = resp;
});
});
}