Add columns in while
Add columns in while
Hey,
This is my problem, I have this object :
[
Login : "azerty",
Email : "test@azert.com",
Permissions : [{
Label : "CanGet",
Value : false
},
{
Label : "IsAdmin",
Value : false
}]
]
I want create for each permission a column, is ok it's work ! But I can get the Value (
I have a for for each columns in a list
["CanGet","IsAdmin]
for (var i = 0; i < role.length; i++) {
var ob = {
title: role[i],
data: function (row, type, val) {
if (row.Permissions[i].Value == true) { // <=====================
return '<input type="checkbox" checked><span class="text"></span>';
} else {
return '<input type="checkbox"><span class="text"></span>';
}
}
};
UI.Module.ManageAPI.list.push(ob);
}
UI.Module.ManageAPI.list : columns
i is always equal to the size of my list
Replies
Sounds like you need to move
UI.Module.ManageAPI.list.push(ob);
into the permission check logic.Allan
I'm sorry but I don't understand.
Why the title with "role[i]" is correct and why the "i" in data is not
I'd need to be able to see a working example of the code please. It might be a closure issue, or I'm just missing something.
Thanks,
Allan