codeguyross
|
|
« on: March 28, 2014, 08:32:04 AM » |
|
Hello,
The first time I click a cell in a property grid I always see the following error pop up in the console: Uncaught TypeError: Cannot read property 'target' of undefined jquery.easyui.min.js:9152 $.datagrid.$.extend.onClickRow jquery.easyui.min.js:9152 jquery.easyui.min.js:7504 x.event.dispatch jquery-1.10.2.min.js:5 x.event.add.v.handle jquery-1.10.2.min.js:5
The line of code it is referencing in Jquery that is popping up the error is: $(this).datagrid("getEditors",_6c5)[0].target.focus();
The problem is that $(this).datagrid("getEditors",_6c5) returns an empty array and thus generates an error when trying to access the '0' element.
Just in case it helps the following is my code for the propertygrid:
$('#PropertyGrid').propertygrid( { onClickCell:function(rowIndex, field, value) { var rows = $('#PropertyGrid').propertygrid('getData').rows; var rowMap = new HashMap(); for(var i=0;i<rows.length;i++) { rowMap.add(rows.name, rows.value); } //allow user to change the name of certain nodes if( rows[rowIndex]['name'] == "name" && (rowMap.get("type") == "Int" || rowMap.get("type") == "Float" || rowMap.get("type") == "String")) { if(rows[rowIndex]['editor'] == null) rows[rowIndex]['editor'] = rows[rowIndex]['editor1']; $('#PropertyGrid').propertygrid('beginEdit',rowIndex); } else if( rows[rowIndex]['name'] == "value" ) { if(rows[rowIndex]['editor'] == null) rows[rowIndex]['editor'] = rows[rowIndex]['editor1']; $('#PropertyGrid').propertygrid('beginEdit',rowIndex); } }, onBeforeEdit:function(index,row){ row.editing = true; updateActionsProperty(index); }, onCancelEdit:function(index,row){ row.editing = false; updateActionsProperty(index); }
}); function updateActionsProperty(index){ $('#PropertyGrid').datagrid('updateRow',{ index: index, row:{} }); }
I find it bad form to modify the jquery code for any reason, so does anyone have any clue as to why jquery would throw and error on first time clicking of a cell in a propertygrid? Is this isolated to me or is it an error that others experience?
Lastly, for some unknown reason on the first click I see a movement crosshair when I click. Its only for a second but then it goes away. I only mention it because there may be some kind of movement event that is happening that I am no aware of that could be causing my error.
Thanks!
|