I’m making a dynamic report viewer for an internal web app I’m building.
if I make ajax call that returns:
I need to grab the values “FirstName”, “LastName” and “PasswrdLastChange” (for a “header”), and then grab each of those values for each row.
Another may look like:
So I’ll need “FirstName”, “LastName”, “MailServer”, and “MailboxSize”
Some sources may have a single field, others may have more than 4. All the rows for each source will each have the same property names.
If the source has no data, I’ll just return an empty set.
If too difficult I may just format the table server side and stick that in the view div.
Thanks.
If you need to extract the properties from the object you can do:
const firstName = objname.FirstName;
//....
That’ll grab the property and the value from the object. You can iterate the object too and save the props you need:
const propsSaved = {"Firstname": {}, "LastName": {}, "Email": {}};
for (const prop of obj) {
if (prop === "FirstName") {
propsSaved.FirstName.push(prop);
} else if (prop === "LastName") {
propsSaved.LastName.push(prop)
} else {
propsSaved.Email.push(prop)
}
}
I think that will. If I misunderstood what you were trying to explain, please tell me, I don’t mind helping.
Salute
Members
Online