ParamQuery grid support forum
General Category => Help for ParamQuery Grid (free version) => Topic started by: joelclark on August 21, 2020, 01:25:01 am
-
Hi There,
So I have a few columns that are nested Json. For example the below column. I want to filter on "['FxCalcConfigType']['Value']" but can't get the filter to point to that value. Is this even possibly? I have been looking and have found nothing. Tried the value functionality in the filter and it did not help :(
{
title: FI.res.fXRates.CalcConfigTypeLabel, dataType: "integer", editable: false, align: "left", minWidth: 150,
render: function (ui) {
//Below line returns the value of the type value so that I don't have to do anything to the entity
return ui.rowData['FxCalcConfigType']['Value'];
},
filter: { crules: [{ condition: 'contain' }], listeners: ['keyup'] }
},
-
1. you need to define dataIndx: 'FxCalcConfigType' for your column.
2. write a custom compare function for the column.filter
conditions: {
contain: {
compare: function (cellData, val) {
//write the custom logic here.
}
}
}
Here is an example for writing custom filter compare function: https://paramquery.com/pro/demos/filter_custom
Please let me know if you need further assistance on this.
-
Still doesn't seem to be working unless i am missing something? I can't event get into the compare function to debug it. My code is below and as you can see in the attached screenshot it still is showing the data as [Object] [object]
{
title: FI.res.fXRates.CalcConfigTypeLabel, dataType: "string", dataIndx: "FxCalcConfigType", editable: false, align: "left", minWidth: 150,
render: function (ui) {
//Below line returns the value of the type value so that I don't have to do anything to the entity
return ui.rowData['FxCalcConfigType']['Value'];
},
filter: { crules: [{ condition: 'contain' }], listeners: ['keyup'] },
conditions: {
contain: {
compare: function (cellData, val) {
if ((cellData.Value + "").indexOf(val) != -1) {
return true;
}
else {
return false;
}
}
}
}
},
-
Hi, have you able to fix this issue? I am also getting the same issue, cellData return "[Object Object]" and I am not able to read that.
-
Recent version of pqgrid makes it very easy to work with nested json data.
Please check this example: https://paramquery.com/pro/demos/json_nested