Cannot read property '_childIndexes' of null

Good morning,

I’m having a problem when trying to colorize cells in my grid. I’m using

grid_1.attachEvent(“onXLE”, function(grid_obj,count)

to attach a function to execute and iterate the rows when data is loaded, but I get the error: Cannot read property ‘_childIndexes’ of null

It sounds to me like the system doesn’t find the cells loaded. Full code below:

	dhtmlx.image_path='js/dhtmlx/imgs/';

	main_layout = new dhtmlXLayoutObject(document.getElementById('activeDevices'), '1C');

	var a = main_layout.cells('a');
	a.setHeight('300');
	a.setText('Device Status');

	grid_1 = a.attachGrid();

	grid_1.attachEvent("onXLE", function(grid_obj,count){
		for (var i=1; i<grid_obj.getRowsNum(); i++){
			switch(grid_obj.cells(i,1).getValue()){
				case "Demo Mode":
					grid_obj.setCellTextStyle(i, 1, "color:green;");
					break;
				case "Initiate Transaction":
					grid_obj.setCellTextStyle(i, 1, "color:green;");
					break;
				case "Transaction Complete":
					grid_obj.setCellTextStyle(i, 1, "color:green;");
					break;	
				case "Transaction Declined":
					grid_obj.setCellTextStyle(i, 1, "color:red;");
					break;
				case "Bulb Out":
					grid_obj.setCellTextStyle(i, 1, "color:red;");
					break;
				case "Unit Fan Down":
					grid_obj.setCellTextStyle(i, 1, "color:red;");
					break;
				case "Signal Weak":
					grid_obj.setCellTextStyle(i, 1, "color:red;");
					break;
				case "Unit Unplugged":
					grid_obj.setCellTextStyle(i, 1, "color:red;");
					break;
				case "Water Pump Failure":
					grid_obj.setCellTextStyle(i, 1, "color:red;");
					break;
				case "Scent Tray Motor Error":
					grid_obj.setCellTextStyle(i, 1, "color:red;");
					break;	
				case "Transducer Failure":
					grid_obj.setCellTextStyle(i, 1, "color:red;");
					break;
				case "Tank Empty":
					grid_obj.setCellTextStyle(i, 1, "color:red;");
					break;
				case "Change Air Filter":
					grid_obj.setCellTextStyle(i, 1, "color:red;");
					break;
				case "Change Scent Tray":
					grid_obj.setCellTextStyle(i, 1, "color:red;");
					break;
				case "Cleab Air Filter/Purifier Elements":
					grid_obj.setCellTextStyle(i, 1, "color:red;");
					break;
										
			}
			
		}


		}); 
	
	grid_1.setIconsPath('../js/dhtmlx/imgs/');
	
	grid_1.setHeader(["MEID","Status","Location","Room","Date/Time"]);
	grid_1.setColTypes("ro,ro,ro,ro,ro");
	
	grid_1.setColSorting('str,str,str,str,int');
	grid_1.init();
	grid_1.loadXML('./data/getDevices.php');	
	grid_1.attachHeader("#text_filter,#text_filter,#text_filter,#text_filter,#text_filter");

I figured out my problem. Both

grid_obj.cells(rId,cId).getValue()

and

grid_obj.setCellTextStyle(rId, cId, “color:green;”);

are expecting row ID, not row index. So I had to use

rId = grid_1.getRowId(i);

to get the ID for the index I was looking at first. Hope this helps anyone else with the same problem.

5 years from this post and it become very useful for me, thanks. Just im going to learn difference between rowid and rowindex