I have been stuck with this issue for a long time now..:(
I have an object that im trying to read the sub-array from. below is the look of the JSON format. im trying to extract the qaccess values from it, as like qaccess.0.product, qaccess.1.product.
"qaccess": [
{
"product": "wm.od.prod.nsr",
"status": "enabled",
"roleIdentifiers": [
],
"permissionIdentifiers": [
]
},
{
"product": "gp.od.dev.nsr",
"status": "Active",
"roleIdentifiers": [
],
"permissionIdentifiers": [
]
}
]
And below if what my code looks like:
addColumn: function(oObj, type, val){
//however i checked now, and found that the `oObj, type, val` returns 'null' and hence i am unable to use the addColumn function anymore. that is one problem i faced and hence took up another approach of adding the function in the `mDataProp`, like the one shown in the EDIT part.
propertySize = oObj.qaccess.length;
for(i=0; i<propertySize; i=i+1){
{
"mDataProp": "qaccess." + i + ".product",
"sTitle": "Status",
"sClass": "_status",
"sWidth": "10%",
}
}
});
})
this.columns.push(col);
// return the index of the new column
return this.columns;
},
To get multiple values of the object, can i write it in for loop as shown above? Ex:
for(i=0; i<propertySize; i=i+1){
{
"mDataProp": "qaccess." + i + ".product"}}.
EDIT:
I also tried doing something like this :
columns: [
{"mRender": function(obj, val, data){
propertySize = data.qaccess.length;
for(i=0; i<propertySize; i=i+1){
col= {
"mDataProp": "qaccess." + i + ".product",
sTitle: "Account Name", sClass: "_accountName", sWidth: "25%"
}
}
}
}]
The data above returns: out of which im trying to get the value of 'qaccess[0].product' and 'qaccess[1].product' in my table.
. qaccess: Array[2]
. 0: Object
. permissionIdentifiers: Array[0]
. product: "wm.od.prod.nsr"
. roleIdentifiers: Array[0]
. status: "enabled"
. 1: Object
⁃ permissionIdentifiers: Array[0]
⁃ product: "gp.od.dev.nsr"
⁃ roleIdentifiers: Array[0]
⁃ status: "Active"
how can i achieve the values of the qaccess array values.
Thanks.