ParamQuery grid support forum
General Category => ParamQuery Pro Evaluation Support => Topic started by: Digital Logix on March 10, 2016, 05:52:04 pm
-
I am using a variable containing column name in search method. The code is:
// check for deleted records
if (res.deleteList.length > 0) {
for (i = 0; i < res.deleteList.length; i++) {
var objd = res.deleteList;
var coln = objd.Name;
var dvals = objd.Ids;
for (j = 0; j < dvals.length; j++) {
var rowList = grid1.search({ row: { coln : dvals[j] } }, true);
alert(rowList.length);
// remove the row from grid
}
}
}
It is not returning the matched rows. How can I get the row from grid using the variables containing the field name and value?
-
In your code, the key name 'coln' is passed as such without substituting it with objd.Name.
The correct way is:
var row = {};
row[ coln ] = dvals[ j ];
//now it can be passed to the method:
var rowList = grid1.search({
row: row,
first: true
);
-
Thanks it works.
A bracket was missing in the last line:
var row = {};
row[ coln ] = dvals[ j ];
//now it can be passed to the method:
var rowList = grid1.search({
row: row,
first: true
});