In my screen I have a ui-grid that need be load when the user click in button "search".
I'm making this:
// Ajax call
$("#btn-Pesquisar").click(function () {
var form = $('#frm-Pesquisar-Acos-Internos');
$.ajax({
cache: false,
async: true,
type: "POST",
url: form.attr('action'),
dataType: "json",
data: form.serialize(),
success: function (result) {
angular.element(document.getElementById('grd-Resultado')).scope().atualizarRegistros(JSON.parse(result));
$('#divResultadoPesquisa').show();
}
});
});
When the call ocurred with success, I call a function called "atualizarRegistros"
$scope.atualizarRegistros = function (result) {
$scope.grdResultado.data = result;
}
This is a definition from my grid:
$scope.grdResultado = {
showGridFooter: true,
enableSorting: true,
enableFiltering: true,
enableColumnResizing: true,
enableGridMenu: true,
columnDefs: [
{ name: 'Código', field: 'COD_GRUPO_ACO', minWidth: 48 },
{ name: 'Norma', field: 'COD_IDENT_NORMA', minWidth: 60 }
]
};
the result is:
[{"COD_IDENT_ACO":"C0981","COD_GRUPO_ACO":"C","COD_SUBGR_ACO":"0","COD_GRUPO_SUCAT":"04","COD_GRUPO_CUSTO":"36","COD_IDENT_FMACO":"5XX","NOM_IDENT_ACO":"P595R","COD_SITUA_ACO":"A","IDC_ACO_TRANS":"N","DTH_INCLU_REG":"2005-11-23T12:13:36","COD_IDENT_USUAR":"AC42911","COD_UNMED_PESES":"G/CM3","COD_GRUPO_ENCHA":null,"COD_ACO_MATPR":null,"COD_SERIE_ACO":null,"COD_IDENT_NORMA":"ACE","COD_TIPO_ACO":"P595R","NOM_ABREV_ACO":"595R","VLR_DIAME_IDEAL":null,"VLR_PESO_ESPEC":7.850,"VLR_TEMT1_LINGO":null,"VLR_TEMT2_LINGO":null,"TEX_OBSER_ACO":"Adição de Ca-Si para globulizar inclusões, processo de desgazeificação no VOD, projeto Flapper Valve.","VLR_TEMTP_LINGO":null,"DESC_ACO":"P595R - ACE"}]
But when the method is executed, I get this error: newRawData.forEach is not a function at Grid.modifyRows
I don't know what i can do now.
Help-me!