I'm using this class in javascript:
function rMotoristaList() {
}
rMotoristaList.prototype.permInsert = false;
rMotoristaList.prototype.permSelect = false;
rMotoristaList.prototype.permUpdate = false;
rMotoristaList.prototype.permDelete = false;
rMotoristaList.prototype.init = function() {
// Pega as permissoes
var perm = new cPermissao();
this.permInsert = perm.verificaPermissao(ID_CAD_MOTORISTAS, "insert");
this.permUpdate = perm.verificaPermissao(ID_CAD_MOTORISTAS, "update");
this.permDelete = perm.verificaPermissao(ID_CAD_MOTORISTAS, "delete");
if (this.permInsert == false) {
$("#btn-add-novo").hide();
}
};
rMotoristaList.prototype.renderGrid = function(data) {
var html = "";
// Faz o loop em todos os elementos retornados
$.each(data,function(index, motorista) {
if (this.permUpdate != false) {
//Do something
}
}
};
The attrbitue permUpdate
is false
, but, when i compare him, inside of $.each(), don't work, i receive a undefined
.
How can i get the value of this.permUpdate
inside $.each()
?