Edit: Revised based on the jsFiddle you provided
// Accessing nested objects
var colField = evt.cell.field; // Obtaining column names from the grid in dojo
var mystring = item[colField] || ""; // Retrieving item based on colField property
var fields = ["Owner", "Home", "Realtor", "Broker"]; // Array of fields to compare against colField
// Checking if Owner, Home, Realtor, or Broker columns are empty in the object
if(fields.indexOf(colField) !== -1 && mystring === "") {
}
Updated jsFiddle: http://jsfiddle.net/3AXN7/4/
Since you have multiple columns to check, it's better to store all the column names in an array and then verify if colField exists in the array instead of using multiple conditions in the if statement.
The issue with this approach is that indexOf is not compatible with IE6-8. To ensure cross-browser compatibility, you can include a polyfill for indexOf function like this:
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function (searchElement /*, fromIndex */) {
"use strict";
if (this === void 0 || this === null)
throw new TypeError();
var t = Object(this);
var len = t.length >>> 0;
if (len === 0)
return -1;
var n = 0;
if (arguments.length > 0) {
n = Number(arguments[1]);
if (n !== n)
n = 0;
else if (n !== 0 && n !== (1 / 0) && n !== -(1 / 0))
n = (n > 0 || -1) * Math.floor(Math.abs(n));
}
if (n >= len)
return -1;
var k = n >= 0
? n
: Math.max(len - Math.abs(n), 0);
for (; k < len; k++) {
if (k in t && t[k] === searchElement)
return k;
}
return -1;
};
}